[R] sem by variable x
    Daniel Caro 
    dcarov at googlemail.com
       
    Tue Jul 20 15:22:04 CEST 2010
    
    
  
Hi R users,
I am new in R. I would like to perform confirmatory factor analysis
for a data set of countries. My data are:
data <- read.csv("ses.raw", header = TRUE)
attach(data)
names(data)
[1] "idcntry" "momed"   "daded"   "dadocu"  "momocu"  "hompos"  "finan"
The country id is "idcntry", my model is "ses.model", and variables to
be included in the analysis are "momed"   "daded"   "dadocu"  "momocu"
 "hompos"  "finan" . How can I run
cfa<-sem(ses.model, cov(data[,2:7], nrow(data)))
summary(cfa)
by country? I am able to perform sem on all data by not by country. I tried
by(data[,2:7], idcntry, function(x) sem(ses.model, cov(data[,2:7]), nrow(data)))
but the output is the same for all countries.
Thank you,
Daniel
    
    
More information about the R-help
mailing list