RE: [R] Help with factanal and missing values

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

Dear Antonio,

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

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 mailing list PLEASE do read the posting guide! 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