Dear all,
Now I'm testing a model with one observed factor and one latent factor which containing two observed factor. I'm modify a Script with two latent factors as follow (path setting part):
Create Labels for Lower Triangular Matrices (fancy shorthand)
Labels for a, c & e pathways from A, C & E latent factors to latent INTECEPT & SLOPE
AlLabs <- paste("al", do.call(c, sapply(seq(1, nf), function(x){ paste(x:nf, x,sep="") })), sep="")
ClLabs <- paste("cl", do.call(c, sapply(seq(1, nf), function(x){ paste(x:nf, x,sep="") })), sep="")
ElLabs <- paste("el", do.call(c, sapply(seq(1, nf), function(x){ paste(x:nf, x,sep="") })), sep="")
Labels for a, c & e pathways from A, C & E residual to observed variables
AsLabs <- paste("as",1:nv,1:nv,sep="")
CsLabs <- paste("cs",1:nv,1:nv,sep="")
EsLabs <- paste("es",1:nv,1:nv,sep="_")
meMZVals <- rep(0,ntv) # start value for MZ means
meDZVals <- rep(0,ntv) # start value for DZ means
meanMZLabs <- paste("mMZ",1:ntv,sep="")
meanDZLabs <- paste("mDZ",1:ntv,sep="")
comFLabs1 <- paste("f",1,1:nsub1,sep="")
comFLabs2 <- paste("f",2,1:nsub2,sep="")
------------------------------------------------------------------------------
Latent factors and path setting
------------------------------------------------------------------------------
pathAl <- mxMatrix(name = "al", type = "Lower", nrow = 2, ncol = 2, labels = AlLabs, free=T, value=0.5)
pathCl <- mxMatrix(name = "cl", type = "Lower", nrow = 2, ncol = 2, labels = ClLabs, free=T, value=0.5)
pathEl <- mxMatrix(name = "el", type = "Lower", nrow = 2, ncol = 2, labels = ElLabs, free=T, value=0.5)
Matrix f for factor loadings on latent phenotype?????
pathF1 <- mxMatrix( type="Full", nrow=nsub1, ncol=1, free=T, values=0.5, #lbound=-1, ubound=1,
labels=comFLabs1, name="fl1" )
pathF2 <- mxMatrix( type="Full", nrow=nsub2, ncol=1, free=T, values=0.5, #lbound=-1, ubound=1,
labels=comFLabs2, name="fl2" ) #nrow= nsub2-1
pathTmp1 <- mxMatrix( type="Full", nrow=nsub2, ncol=1, free=F, values=0, name="patht1")
pathTmp2 <- mxMatrix( type="Full", nrow=nsub1, ncol=1, free=F, values=0, name="patht2")
pathF <- mxAlgebra( expression=cbind(rbind(fl1,patht1),rbind(patht2,fl2)), name="fl" )
Matrices as, cs, and es to store a, c, and e path coefficients for specific factors
pathAs <- mxMatrix( type="Diag", nrow=nv, ncol=nv, free=TRUE, values=0.5, labels=AsLabs,name="as")
pathCs <- mxMatrix( type="Diag", nrow=nv, ncol=nv, free=TRUE, values=0.5, labels=CsLabs,name="cs")
pathEs <- mxMatrix( type="Diag", nrow=nv, ncol=nv, free=TRUE, values=0.5, labels=EsLabs,name="es" )
Matrices A, C, and E compute variance components
covA <- mxAlgebra( expression=fl %&% (al %% t(al)) + as %% t(as), name="A" )
covC <- mxAlgebra( expression=fl %&% (cl %% t(cl)) + cs %% t(cs), name="C" )
covE <- mxAlgebra( expression=fl %&% (el %% t(el)) + es %% t(es), name="E" )
How can I modify the "Matrix f" setting part, just delete the pathF2?
Another qestion is that during statistic inference, what's the diffence between the p value of ACE vs CE and p value of AE vs E? Usually the later one is smaller than the former one, is it reasonable to use the p value of AE vs. E as the significance of heritability, especially when the p of ACE vs. CE is non significant?
Many thanks and best regards
Lizhi