# Modify the Script of Common pathway model

3 posts / 0 new Offline
Joined: 04/21/2016 - 00:27
Modify the Script of Common pathway model

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):

# 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="
")

# ------------------------------------------------------------------------------

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)

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 Offline
Joined: 03/01/2013 - 14:09
Clarify?

Hi

I'm not sure what model you are trying to fit. Can you clarify

"Now I'm testing a model with one observed factor and one latent factor which containing two observed factor."

Factors are not usually observed, but latent, so I am confused. Offline
Joined: 04/21/2016 - 00:27
Sorry for the confusing expresssion

Sorry for the confusing expresssion. I mean three phenotypes in this model. It is a common path way model rather than a trivariate cholesky model. Two phenotypes consititute a latent factor, that means there is only a latent factor in this model. However in the codes I pasted there were two latent factors, one contained two phenotypes and the other one contained only one phenotype. Maybe it is unreasonable to set one latent factor containing only one phenotype, right? Hence I want to deleted one latent factor and responding f matrix.