RE: [R] Help with factanal and missing values

From: John Fox <jfox_at_mcmaster.ca>
Date: Wed 14 Jul 2004 - 02:12:53 EST


Dear Antonio,

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of
> Antonio Prioglio
> Sent: Tuesday, July 13, 2004 9:32 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Help with factanal and missing values
>
> Hi list,
>
> I'm performing a series of confirmatory factor analysis on
> different groupings of items from data collected with
> questionnaires. There are some missing values.
>
> For those sets with no missing values I call
> factanal(datamatrix,factors=n)
>
> where datamatrix is a table of all observations for the items
> under investigation.
>
> This call fails when there are missing values.
> help(factanal) does not give an example on calls with
> na.action and and mentiones a formula.
>
> (Venables and Ripley, 2002 give only one example on p. 323
> for a case where the covariance has already been calculated)
>
> Could someone give me an example on such a call for a simple CFA?

Two solutions are to use na.omit() to eliminate observations with missing data -- factanal(na.omit(datamatrix), factors=n) -- or to use a formula argument to factanal and pass the data as a data frame via the data argument -- factanal(~ var1 + ... + vark, factors=n, data=as.data.frame(datamatrix)).

By the way, what factanal() does would conventionally be described as exploratory, not confirmatory, factor analysis. For the latter, you might try the sem package.

I hope that this helps,
 John



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 14 02:25:22 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 02:35:51 EST