[R] Confirmatory Factor Analysis in R? SEM?
John Fox
jfox at mcmaster.ca
Thu Jan 29 05:19:47 CET 2004
Dear Arnab,
You can indeed fit confirmatory factor analysis models with the sem
package, and ?sem includes an example of a second-order CFI (though I'm not
sure I see the point of factor-analyzing uncorrelated variables). In factor
analysis, moreover, the observed variables are functions of the factors,
not vice-versa (which is how you've specified it). As well, you have to
define variances and possibly covariances for the factors.
You'll find a simpler example in some lecture notes at
<http://socserv.socsci.mcmaster.ca/jfox/Courses/soc761/index.html#lecture-notes>,
along with the corresponding sem commands.
I hope that this helps,
John
At 01:21 AM 1/29/2004 +0000, Arnab mukherji wrote:
>Hi
>
>Has anyone used R to conduct confirmatory factor analysis? This email
>pertains to use of SEM.
>
>For context consider an example: the basic idea is that there are a bunch
>of observables variables (say study habbits, amount of time reading in the
>bus, doing homework, helping other do homework, doing follow-up on errors
>etc.) and one believes that all these variables maybe measured by two or
>more unobservable constructs... say ability to work hard and ability to
>follow instructions. If one has empirical evidence from earlier studies
>which relates similar observable to similar unobservables one wants to do
>a confirmatory factor analysis to check if the posited relationship holds
>in the current data being analyzed.
>
>I thought the way out would be to use SEM - the structural equation model
>library. However, i am not sure how to estimate SEM objects where factors
>are unobservable. The only discussion pertian to the case of endogenously
>detemined observable variables.
>
>here is a test case of what i'd like to implement
>
>#example Measurement Model
>
>x1<-runif(200)
>x2<-rbinom(200, 20, 0.75)
>x3<-runif(200)
>x4<-runif(200)
>dat<-as.data.frame(x1 =x1, x2 = x2, x3 = x3, x4 = x4)
>
>v.c<-cor(dat,use = "complete.obs")
>ind<-upper.tri(v.c)
>v.c[ind]<-0
>model.dhp<-matrix (c(
> "x1 -> HWK", "gam11", NA,
> "x2 -> HWK", "gam21", NA,
> "x2 -> FI", "gam22", NA,
> "x3 -> HWK", "gam31", NA,
> "x3 -> F1", "gam32", NA,
> "x4 -> F1", "gam42", NA),
> ncol = 3, byrow = TRUE)
>These are the Factor loadings i'd like to test for:
> variable HWK FI
> x1 0.75 0
> x2 0.20 0.68
> x3 0.2 0.5
> x4 0 0.24
>
>
>thanks for any help on this.
>
>Arnab
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
More information about the R-help
mailing list