You are here


Primary tabs

Wiki home page

Confidence Intervals

To request confidence intervals from a model, simply include a call to mxCI in the model, and add "intervals=TRUE" to the call to mxRun()

manifests <- names(demoOneFactor)
latents <- c("G")
m1 <- mxModel("OneFactor",type="RAM",
      manifestVars = manifests,
      latentVars = latents,
      mxPath(from=latents, to=manifests),
      mxPath(from=manifests, arrows=2),
      mxPath(from=latents, arrows=2, free=FALSE, values=1.0),
      mxData(cov(demoOneFactor), type="cov", numObs=500)
m1 <- mxModel(m1, mxCI(c('OneFactor.A')))
m1 = mxRun(m1, intervals=TRUE)

The interval and type defaults give the 95% upper and lower CIs that most users will want.

confidence intervals:
                    lbound  estimate    ubound
OneFactor.A[1,6] 0.3679342 0.3971527 0.4290522
OneFactor.A[2,6] 0.4695034 0.5036616 0.5411646
OneFactor.A[3,6] 0.5389615 0.5772421 0.6193344
OneFactor.A[4,6] 0.6578832 0.7027746 0.7522656
OneFactor.A[5,6] 0.7464224 0.7962510 0.8512582

The CI request list is quite intelligent and can take any mixture of labels, matrix or algebra names, matrices with column and row indices. So the following are all fine, as long as they are legal objects found in the model or its submodels.

  mxCI(c('m1.A', 'm1.A[,1]', 'myAlg'))