manifests <- colnames(data) diet<- colnames(data)[1:4] cancer <- colnames(data)[5:6] latents <-c("洋食傾向", "消化管ガン") model <- mxModel("PLS", type="RAM", manifestVars=manifests, latentVars=latents, mxPath(from=cancer, arrows=2,free=T, labels=c("e1","e2"),values=1), mxPath(from=diet, to="洋食傾向", arrows=1, free=T, labels=c("l1","l2","l3","l4"),values=1), mxPath( from=c("総熱量","肉類"),arrows=2, connect="unique.pairs", free=c(F,T,F), values=c(1,0,1), labels=c("varF1","cor1","varG1")), mxPath( from=c("総熱量","乳製品"),arrows=2, connect="unique.pairs", free=c(F,T,F), values=c(1,0,1), labels=c("varF2","cor2","varG2")), mxPath( from=c("総熱量","酒類"),arrows=2, connect="unique.pairs", free=c(F,T,F), values=c(1,0,1), labels=c("varF3","cor3","varG3")), mxPath( from=c("肉類","乳製品"),arrows=2, connect="unique.pairs", free=c(F,T,F), values=c(1,0,1), labels=c("varF4","cor4","varG4")), mxPath( from=c("肉類","酒類"),arrows=2, connect="unique.pairs", free=c(F,T,F), values=c(1,0,1), labels=c("varF5","cor5","varG5")), mxPath( from=c("乳製品","酒類"),arrows=2, connect="unique.pairs", free=c(F,T,F), values=c(1,0,1), labels=c("varF6","cor6","varG6")), mxPath(from="消化管ガン",to=cancer,arrows=1, free=T,labels=c("l5","l6"),values=1), mxPath( from= "洋食傾向",to="消化管ガン",arrows=1, free=F,labels="cor",values=1), mxPath(from= latents, arrows=2,free=F,labels=c("e7","e8"),values=c(0,1)), mxData(observed=cor(data),type="cor",numObs=nrow(data)) )
|