[R] Help with factanal and missing values

2004-07-13 Thread Antonio Prioglio
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?

Thanks for the help.



Saluti,
Antonio Prioglio

-- 
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
Aristoteles


/\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL 
 X   - AGAINST MS ATTACHMENTS
/ \

http://www.gnu.org/philosophy/no-word-attachments.html

__
[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


RE: [R] Help with factanal and missing values

2004-07-13 Thread John Fox
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


RE: [R] Help with factanal and missing values

2004-07-13 Thread Antonio Prioglio
On Tue, 13 Jul 2004, John Fox wrote:
 
 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)).

Thanks this was helpful and more elegant than my solution to select the 
data with a call to complete.cases().

 
 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.
 

Actually these CFAs are preliminary to a Path Analysis I had ambitions to 
do with the sem package rather than LISREL.

Could you give an example on how to do CFA with sem?

Saluti,
Antonio Prioglio

-- 
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
Aristoteles


/\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL 
 X   - AGAINST MS ATTACHMENTS
/ \

http://www.gnu.org/philosophy/no-word-attachments.html

__
[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


RE: [R] Help with factanal and missing values

2004-07-13 Thread John Fox
Dear Antonio, 

 -Original Message-
 From: Antonio Prioglio [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, July 13, 2004 12:50 PM
 To: John Fox
 Cc: [EMAIL PROTECTED]
 Subject: RE: [R] Help with factanal and missing values
 
 On Tue, 13 Jul 2004, John Fox wrote:
  
  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)).
 
 Thanks this was helpful and more elegant than my solution to 
 select the data with a call to complete.cases().
 
  
  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.
  
 
 Actually these CFAs are preliminary to a Path Analysis I had 
 ambitions to do with the sem package rather than LISREL.
 
 Could you give an example on how to do CFA with sem?

Among the examples in ?sem is a second-order CFA.

Regards,
 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


RE: [R] Help with factanal and missing values

2004-07-13 Thread Antonio Prioglio
On Tue, 13 Jul 2004, John Fox wrote:
  Could you give an example on how to do CFA with sem?
 
 Among the examples in ?sem is a second-order CFA.

Ok, sorry I forgot about the Thurstone example as I was focusing on Path 
Analysis example when reading the sem doc.

I understand this is a model taken from another source.

In the model specification I notice a F4-F1, F4-F2, F4-F3.

This is something I do not understand.

In a normal case where one is iterested in the factorial validity of the 
indicator variables, would it be appropiate to use the same specification 
just omitting the above links?

Saluti,
Antonio Prioglio

-- 
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
Aristoteles


/\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL 
 X   - AGAINST MS ATTACHMENTS
/ \

http://www.gnu.org/philosophy/no-word-attachments.html

__
[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


RE: [R] Help with factanal and missing values

2004-07-13 Thread Antonio Prioglio
On Tue, 13 Jul 2004, John Fox wrote:

 
 Among the examples in ?sem is a second-order CFA.
 
Thanks now I have it running, hopefully in a correct way.

By the way I notice in the output a GFI index that in your online appendix
to your 2002 book describe as an ad hoc measure.

Could you comment on how it compares with the Comparative Fit Index (CFI; 
Bentler, 1990) which according to Byrne 1994 is a revised version of the 
Bentler-Bonnet (1980) Normed Fit Index?

Thanks again for your valuable help.

Saluti,
Antonio Prioglio

-- 
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
Aristoteles


/\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL 
 X   - AGAINST MS ATTACHMENTS
/ \

http://www.gnu.org/philosophy/no-word-attachments.html

__
[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


RE: [R] Help with factanal and missing values

2004-07-13 Thread John Fox
Dear Antonio,

This example is (as stated) a second-order CFI, where each of the primary
factors, F1, F2, and F3 depends upon the second-order factor F4. To have no
second-order structure, simply define variances and (assuming that you're
specifying correlated factors) covariances among the factors. For the
Thurstone example, these would be, in addition to the variances already set
to 1, F1 - F2, F1 - F3, and F2 - F3.

I hope that this helps,
 John 

 -Original Message-
 From: Antonio Prioglio [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, July 13, 2004 1:53 PM
 To: John Fox
 Cc: [EMAIL PROTECTED]
 Subject: RE: [R] Help with factanal and missing values
 
 On Tue, 13 Jul 2004, John Fox wrote:
   Could you give an example on how to do CFA with sem?
  
  Among the examples in ?sem is a second-order CFA.
 
 Ok, sorry I forgot about the Thurstone example as I was 
 focusing on Path Analysis example when reading the sem doc.
 
 I understand this is a model taken from another source.
 
 In the model specification I notice a F4-F1, F4-F2, F4-F3.
 
 This is something I do not understand.
 
 In a normal case where one is iterested in the factorial 
 validity of the indicator variables, would it be appropiate 
 to use the same specification just omitting the above links?
 
 Saluti,
 Antonio Prioglio
 
 --
 We are what we repeatedly do. Excellence, then, is not an 
 act, but a habit.
   Aristoteles
 
 
 /\
 \ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL 
  X   - AGAINST MS ATTACHMENTS
 / \
 
 http://www.gnu.org/philosophy/no-word-attachments.html
 


__
[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


RE: [R] Help with factanal and missing values

2004-07-13 Thread John Fox
Dear Antonio,

I'm afraid that you're asking the wrong person about this, because the
literature on goodness of fit measures in SEMs strikes me as mostly alchemy.

As I recall, there are several chapters discussing fit measures in Bollen
and Long, eds., Testing Structural Equation Models. Perhaps these would be
of help.

Regards,
 John 

 -Original Message-
 From: Antonio Prioglio [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, July 13, 2004 3:22 PM
 To: John Fox
 Cc: [EMAIL PROTECTED]
 Subject: RE: [R] Help with factanal and missing values
 
 On Tue, 13 Jul 2004, John Fox wrote:
 
  
  Among the examples in ?sem is a second-order CFA.
  
 Thanks now I have it running, hopefully in a correct way.
 
 By the way I notice in the output a GFI index that in your 
 online appendix to your 2002 book describe as an ad hoc measure.
 
 Could you comment on how it compares with the Comparative Fit 
 Index (CFI; Bentler, 1990) which according to Byrne 1994 is a 
 revised version of the Bentler-Bonnet (1980) Normed Fit Index?
 
 Thanks again for your valuable help.

__
[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


RE: [R] Help with factanal and missing values

2004-07-13 Thread Antonio Prioglio
On Tue, 13 Jul 2004, John Fox wrote:

 Dear Antonio,
 
 This example is (as stated) a second-order CFI, where each of the primary
 factors, F1, F2, and F3 depends upon the second-order factor F4. To have no
 second-order structure, simply define variances and (assuming that you're
 specifying correlated factors) covariances among the factors. For the
 Thurstone example, these would be, in addition to the variances already set
 to 1, F1 - F2, F1 - F3, and F2 - F3.

Ok I understand the second order part in relation to F4.

I'm afraid I'm a bit slow on the last part.

Fn - Fn  NA  1 is the variance for the factor n.
Fn - Item.a   lam.z   NA is the grouping of the items to each factor
Fn - Fm  gam.w   NA I take is the covariance among factors.

Is this correct? Do I need to set variances for each item (Item.a - 
Item.a)? 

Saluti,
Antonio Prioglio

-- 
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
Aristoteles


/\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL 
 X   - AGAINST MS ATTACHMENTS
/ \

http://www.gnu.org/philosophy/no-word-attachments.html

__
[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


RE: [R] Help with factanal and missing values

2004-07-13 Thread John Fox
Dear Antonio, 

 -Original Message-
 From: Antonio Prioglio [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, July 13, 2004 5:54 PM
 To: John Fox
 Cc: [EMAIL PROTECTED]
 Subject: RE: [R] Help with factanal and missing values
 
 On Tue, 13 Jul 2004, John Fox wrote:
 
  Dear Antonio,
  
  This example is (as stated) a second-order CFI, where each of the 
  primary factors, F1, F2, and F3 depends upon the 
 second-order factor 
  F4. To have no second-order structure, simply define variances and 
  (assuming that you're specifying correlated factors) 
 covariances among 
  the factors. For the Thurstone example, these would be, in 
 addition to 
  the variances already set to 1, F1 - F2, F1 - F3, and F2 - F3.
 
 Ok I understand the second order part in relation to F4.
 
 I'm afraid I'm a bit slow on the last part.
 
 Fn - FnNA  1 is the variance for the factor n.

Yes. This is set to 1, standardizing the factors, which is conventional.

 Fn - Item.a   lam.z NA is the grouping of the items to each factor

These (i.e., the lambdas) are conventionally called factor loadings.

 Fn - Fm  gam.w NA I take is the covariance among factors.
 

Yes, though it is unconventional to use gamma to represent a covariance (a
correlation, since the factors are presumably standardized) in factor
analysis.

 Is this correct? Do I need to set variances for each item 
 (Item.a - Item.a)? 
 

Yes. These *error* variances, which should be free parameters, are
conventionally called uniquenesses in factor analysis.

As a general matter, it would help, I think, to look more carefully at the
example, since it includes factor loadings and uniquenesses. If you haven't
already done so, you might also look at the appendix on structural-equation
models to my R and S-PLUS Companion, which is at
http://socserv.socsci.mcmaster.ca/jfox/Books/Companion/appendix-sems.pdf.
This appendix doesn't include a CFA example, but it does explain how to
prepare input to the sem() function.

Regards,
John

 Saluti,
 Antonio Prioglio
 
 --
 We are what we repeatedly do. Excellence, then, is not an 
 act, but a habit.
   Aristoteles
 
 
 /\
 \ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL 
  X   - AGAINST MS ATTACHMENTS
 / \
 
 http://www.gnu.org/philosophy/no-word-attachments.html
 


__
[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