Dear Antonio, > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Antonio Prioglio > Sent: Tuesday, July 13, 2004 9:32 AM > To: [EMAIL PROTECTED] > 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 ______________________________________________ [EMAIL PROTECTED] 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