mxParametricBootstrap | R Documentation |
Data is simulated from ‘nullModel’. The parameters named by ‘labels’ are freed to obtain the alternative model. The alternative model is fit against each simulated data set.
mxParametricBootstrap(nullModel, labels,
alternative=c("two.sided", "greater", "less"),
..., alpha=0.05, correction=p.adjust.methods,
previousRun=NULL, replications=400, checkHess=FALSE,
signif.stars = getOption("show.signif.stars"))
nullModel |
The model specifying the null distribution |
labels |
A character vector of parameters to free to obtain the alternative model |
alternative |
a character string specifying the alternative hypothesis |
... |
Not used. Forces remaining arguments to be specified by name. |
alpha |
The false positive rate |
correction |
How to adjust the p values for multiple tests. |
replications |
The number of resampling replications. If available, replications from prior invocation will be reused. |
previousRun |
Results to re-use from a previous bootstrap. |
checkHess |
Whether to approximate the Hessian in each replication |
signif.stars |
logical. If TRUE, ‘significance stars’ are printed for each coefficient. |
When the model has a default compute plan and ‘checkHess’ is
kept at FALSE then the Hessian will not be approximated or checked.
On the other hand, ‘checkHess’ is TRUE then the Hessian will be
approximated by finite differences. This procedure is of some value
because it can be informative to check whether the Hessian is positive
definite (see mxComputeHessianQuality
). However,
approximating the Hessian is often costly in terms of CPU time. For
bootstrapping, the parameter estimates derived from the resampled data
are typically of primary interest.
A data frame is returned containing the test results. Details of the bootstrap replications are stored in the ‘bootData’ attribute on the data frame.
library(OpenMx)
data(demoOneFactor)
manifests <- names(demoOneFactor)
latents <- c("G")
base <- mxModel(
"OneFactorCov", type="RAM",
manifestVars = manifests,
latentVars = latents,
mxPath(from=latents, to=manifests, values=0, free=FALSE, labels=paste0('l',1:length(manifests))),
mxPath(from=manifests, arrows=2, values=rlnorm(length(manifests)), lbound=.01),
mxPath(from=latents, arrows=2, free=FALSE, values=1.0),
mxPath(from = 'one', to = manifests, values=0, free=TRUE, labels=paste0('m',1:length(manifests))),
mxData(demoOneFactor, type="raw"))
base <- mxRun(base)
# use more replications, 8 is for demonstration purpose only
mxParametricBootstrap(base, paste0('l', 1:length(manifests)),
"two.sided", replications=8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.