Hello
I am using sem to look at the direct effect of one variable on another but i am
uncertain if i am progressing correctly.
An example:
covar1<- matrix(c(0.4,-0.2,3,-0.2 , 0.3,-2 , 3 ,-2 , 60), nrow=3,byrow=T)
rownames(covar1)<-colnames(covar1)<-c("endo","exo","med")
path1<-matrix(c( "exo -> endo", "g1", NA,
"exo -> med", "g2", NA,
"med -> endo", "g3", NA
"med<->med",NA,1,
"endo<->endo",NA,1), ncol=3,byrow=T)
output2<-sem(path1,covar1,N=400,fixed=c("exo"))
summary(output)
With this i can get the direct effect of exo on endo.
But if i want 'med' above to be a latent variable that is identified by a
number of variables - in the example below i use just one - do i proceed as
follows.
##With latent variable
path2<-matrix(c( "exo -> endo", "g1",NA,
"exo -> latent", "g2", NA,
"latent -> endo","g3", NA,
"latent -> med", "g4", NA,
"med<->med",NA,1, "endo<->endo",NA,1
,
"latent<->latent",NA,1), ncol=3,byrow=T)
output2<-sem(path2,covar1,N=400,fixed=c("exo"))
Is this the correct way to formulate this please?
thanks for any advice
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.