umxCI: Add (and, optionally, run) confidence intervals to a...

umxCIR Documentation

Add (and, optionally, run) confidence intervals to a structural model.

Description

umxCI adds OpenMx::mxCI() calls for requested (default all) parameters in a model, runs these CIs if necessary, and reports them in a neat summary.

Usage

umxCI(
  model = NULL,
  which = c("ALL", NA, "list of your making"),
  remove = FALSE,
  run = c("no", "yes", "if necessary", "show"),
  interval = 0.95,
  type = c("both", "lower", "upper"),
  regex = NULL,
  showErrorCodes = TRUE
)

Arguments

model

The mxModel() you wish to report mxCI()s on

which

What CIs to add: c("ALL", NA, "list of your making")

remove

= FALSE (if set, removes existing specified CIs from the model)

run

Whether or not to compute the CIs. Valid values = "no" (default), "yes", "if necessary". 'show' means print the intervals if computed, or list their names if not.

interval

The interval for newly added CIs (defaults to 0.95)

type

The type of CI (defaults to "both", options are "lower" and "upper")

regex

Add CIs for labels matching this regular expression (over-rides which)

showErrorCodes

Whether to show errors (default == TRUE)

Details

umxCI also reports if any problems were encountered. The codes are standard OpenMx errors and warnings

  • 1: The final iterate satisfies the optimality conditions to the accuracy requested, but the sequence of iterates has not yet converged. NPSOL was terminated because no further improvement could be made in the merit function (Mx status GREEN)

  • 2: The linear constraints and bounds could not be satisfied. The problem has no feasible solution.

  • 3: The nonlinear constraints and bounds could not be satisfied. The problem may have no feasible solution.

  • 4: The major iteration limit was reached (Mx status BLUE).

  • 6: The model does not satisfy the first-order optimality conditions to the required accuracy, and no improved point for the merit function could be found during the final linesearch (Mx status RED)

  • 7: The function derivatives returned by funcon or funobj appear to be incorrect.

  • 9: An input parameter was invalid.

If run = "no", the function simply adds the CI requests, but returns the model without running them.

Value

  • mxModel()

References

See Also

  • stats::confint(), umxConfint(), umxCI(), umxModify()

Other Reporting functions: RMSEA.MxModel(), RMSEA.summary.mxmodel(), RMSEA(), extractAIC.MxModel(), loadings.MxModel(), loadings(), residuals.MxModel(), tmx_show.MxMatrix(), tmx_show(), umxCI_boot(), umxConfint(), umxExpCov(), umxExpMeans(), umxFitIndices(), umxRotate()

Examples

## Not run: 
require(umx)
data(demoOneFactor)
manifests = names(demoOneFactor)

m1 = umxRAM("One Factor", data = demoOneFactor, type = "cov",
	umxPath("G", to = manifests),
	umxPath(var = manifests),
	umxPath(var = "G", fixedAt = 1)
)
m1$intervals # none yet - empty list()
m1 = umxCI(m1)
m1$intervals # $G_to_x1...
m1 = umxCI(m1, remove = TRUE) # remove CIs from the model and return it
m1$intervals # none again

# Add CIs by name
parameters(m1, patt="_with_")
m1 = umxCI(m1, which = "x1_with_x1")
m1 = umxCI(m1, which = c("x1_with_x1", "x2_with_x2"))
m1 = umxCI(m1, regex = "x1_with_", run= "yes")
#           lbound estimate ubound lbound Code ubound Code
# x1_with_x1  0.036    0.041  0.047           0           0

# ========================
# = A twin model example =
# ========================
data(twinData) 
mzData = subset(twinData, zygosity == "MZFF")
dzData = subset(twinData, zygosity == "DZFF")
m1 = umxACE(selDVs = c("bmi1","bmi2"), dzData = dzData, mzData = mzData)
umxCI(m1, run = "show") # show what will be requested
umxCI(m1, run = "yes") # actually compute the CIs
# Don't force update of CIs, but if they were just added, then calculate them
umxCI(m1, run = "if necessary")
m1 = umxCI(m1, remove = TRUE) # remove them all
m1$intervals # none!
# Show what parameters are available to get CIs on
umxParameters(m1) 
# Request a CI by label:
m1 = umxCI(m1, which = "a_r1c1", run = "yes")

## End(Not run)

umx documentation built on May 29, 2024, 5:40 a.m.

Related to umxCI in umx...