Function to calculate confidence intervals in parallel in a model.
omxParallelCI(model, run = TRUE)
model | a fitted MxModel object. |
run | a boolean indicating if model should be run. Set to TRUE by default |
data(demoOneFactor) manifests <- names(demoOneFactor) latents <- c("factor") nManifest <- length(manifests) nVars <- nManifest + length(latents) factorModel <- mxModel("One Factor", type="RAM", manifestVars = manifests, latentVars = latents, mxPath(from=latents, to=manifests, free=c(FALSE,TRUE,TRUE,TRUE,TRUE), values=1), mxPath(from=manifests, arrows=2, lbound=.0001), mxPath(from=latents, arrows=2, free=TRUE, values=1.0), mxData(cov(demoOneFactor), type="cov", numObs=500), # mxPath(from="one", to=manifests, arrows=1, free=T, values=mean(demoOneFactor)), # mxData(demoOneFactor, type="raw"), mxMatrix("Iden", nrow=nVars, name="I"), mxMatrix("Full", free=FALSE, values=diag(nrow=nManifest, ncol=nVars), name="Eff"), mxAlgebra(Eff%*%solve(I-A), name="Z"), mxAlgebra(Z%*%S%*%t(Z), name="C"), mxAlgebra(sqrt(diag2vec(C)), name="P"), mxCI(c("P")) ) factorFit <- mxRun(factorModel, intervals=FALSE) factorParallel <- omxParallelCI(factorFit) # See the results... print(factorParallel@output$confidenceIntervals) lbound ubound One Factor.P[1,1] 0.4193000 0.4747328 One Factor.P[2,1] 0.5082290 0.5754222 One Factor.P[3,1] 0.5755068 0.6515979 One Factor.P[4,1] 0.6871788 0.7780409 One Factor.P[5,1] 0.7704188 0.8722923
Please add material here as you learn... If you have questions not answers, then add those here: That's how a wiki works.