[R] na.action in stats::factanal()

Timothy Bates timothy.c.bates at gmail.com
Tue Feb 7 18:18:40 CET 2012


Thanks for the clear explanation Terry!

It gets ugly for many factanal applications, where you are dealing with 300 variables…

One question: what would be wrong with auto generating the formula from a matrix call?

That way the matrix call gets the benefit of returning scores.

Also: you say a person using the non-formula version might know what they are doing. My guess is that is not the case; Most non-experts do just this.

And an expert could still not get scores back, no?

best, tim

PS: If anyone who cares about documentation is reading, it would be lovely to include a valid example for getting scores in a realistic dataset with NAs… where the na.action has to be set.


On 7 Feb 2012, at 2:40 PM, Terry Therneau wrote:

>> Does factanal() force the user to use the formula interface if they
>> wish to specify an na.action?
> 
> Short answer: yes.
> 
> Long answer: The handling of na.action is a built in part of the formula
> processing functions, so it's automatic when dealing with a formula.
> There are also downstream effects on predict() and resid() that are
> worked out for the formula case, but aren't clear otherwise.  So-
>   a. it would require extra programming and thought to work it out for
> matrix vector input, and the "right" answer isn't clear (it's harder
> than you might think).
>   b. the usual assumption when a matrix/vector is given directly is
> "the user knows what he's doing, or wouldn't have called it this way."
> For many routines, the matrix input is a speedup for simulations.
>  c. factanal is unusual -- most routines split the two inputs.
> glm=formula interface & glm.fit=matrix interface, lm & lm.fit, coxph &
> coxph.fit, ....
> 
> Terry Therneau
> 
> 



More information about the R-help mailing list