Description Usage Arguments Details Value See Also Examples

Bootstrapping can help to assess the variability in parameter estimates. A new sample is draw from current data by unformly sampling the original data with replacement. Then the model is fit to these new data. This process is repeated many times. Quantiles of the estimates from all these replications can be used to assess the variability of parameters.

1 2 3 4 | ```
mxBootstrap(model, replications=200, ...,
data=NULL, plan=NULL, verbose=0L,
parallel=TRUE, only=as.integer(NA),
OK=mxOption(model, "Status OK"), checkHess=FALSE)
``` |

`model` |
The MxModel to be run. |

`replications` |
The number of resampling replications. If available, replications from prior mxBootstrap invocations will be reused. |

`...` |
Not used. Forces remaining arguments to be specified by name. |

`data` |
A character vector of data or model names |

`plan` |
Deprecated |

`verbose` |
For levels greater than 0, enables runtime diagnostics |

`parallel` |
Whether to process the replications in parallel |

`only` |
When provided, only the given replication from a prior
run of |

`OK` |
The set of status code that are considered successful |

`checkHess` |
Whether to approximate the Hessian in each replication |

By default, all datasets in the given model are resampled independently. If resampling is desired from only some of the datasets then the models containing them can be listed in the ‘data’ parameter.

The `frequency`

column in the `mxData`

object is used
represent a resampled dataset. When resampling, the original row
proportions, as given by the original `frequency`

column, are
respected.

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.

On occasion, replications will fail. Sometimes it can be helpful to exactly reproduce a failed replication to attempt to pinpoint the cause of failure. The ‘only’ option facilitates this kind of investigation. In normal operation, mxBootstrap uses the regular R random number generator to generate a seed for each replication. This seed is used to seed an internal pseudorandom number generator (currently the Mersenne Twister algorithm). These per-replication seeds are stored as part of the bootstrap output. When ‘only’ is specified, the associated stored seed is use to seed the internal random number generator so that identical weights can be regenerated.

‘mxBootstrap’ does not currently offer special support for nested or multilevel data. Rows are assumed model-wise independent.

The given model is returned with
the compute plan modified to consist of
`mxComputeBootstrap`

. Results of the bootstrap replications are
stored inside the compute plan. `mxSummary`

can be used to
obtain per-parameter quantiles and standard errors.

`mxBootstrapEval`

, `mxComputeBootstrap`

,
`mxSummary`

, `mxBootstrapStdizeRAMpaths`

,
`as.statusCode`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ```
library(OpenMx)
data(multiData1)
manifests <- c("x1", "x2", "y")
biRegModelRaw <- mxModel(
"Regression of y on x1 and x2",
type="RAM",
manifestVars=manifests,
mxPath(from=c("x1","x2"), to="y",
arrows=1,
free=TRUE, values=.2, labels=c("b1", "b2")),
mxPath(from=manifests,
arrows=2,
free=TRUE, values=.8,
labels=c("VarX1", "VarX2", "VarE")),
mxPath(from="x1", to="x2",
arrows=2,
free=TRUE, values=.2,
labels=c("CovX1X2")),
mxPath(from="one", to=manifests,
arrows=1, free=TRUE, values=.1,
labels=c("MeanX1", "MeanX2", "MeanY")),
mxData(observed=multiData1, type="raw"))
biRegModelRawOut <- mxRun(biRegModelRaw)
boot <- mxBootstrap(biRegModelRawOut, 10) # start with 10
summary(boot)
# Looks good, now do the rest
## Not run: boot <- mxBootstrap(boot)
summary(boot)
# examine replication 3
boot3 <- mxBootstrap(boot, only=3)
print(coef(boot3))
print(boot$compute$output$raw[3,names(coef(boot3))])
``` |

OpenMx documentation built on May 12, 2018, 1:04 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.