Performs a coverage check analysis by generating data from a model, fitting it multiple times
with different fit arguments, and plotting the results. Works with fitArgs/
fittingModel combinations that fit with either backend='julia' (the
ctFit default) or backend='stan'.
Arguments
- initialData
An initial dataset to fit to determine 'true' parameters for further generation.
- fittingModel
A ctModel object used for fitting the data
- niter
Number of iterations to run
- fitArgs
Named list of fit argument sets to test (e.g., list(boot = list(optimcontrol = list(uncertainty = 'bootstrap')), hess = list(optimcontrol = list(uncertainty = 'hessian'))))
- cores
The most CPU cores the check uses at once. Iterations run
cores %/% fitCoresat a time, each fit onfitCores.- fitCores
Number of cores for each inner
ctFitcall, at mostcores. This is enforced after merging eachfitArgsentry so that worker fits cannot take more than their share.- generateCores
Number of cores for
ctGenerateFromFitwhen generating replicated datasets, at mostcores. Defaults tofitCores; set it explicitly to use more cores for generation.- plotEvery
Print plots every n iterations; by default every 10, or every
coresiterations when that is more.
Examples
if (FALSE) { # \dontrun{
# Does the Hessian interval cover as often as it says? 100 datasets
# generated from the fit to ctstantestdat, each fitted twice.
model <- ctModel(type = 'ct', manifestNames = 'Y1', latentNames = 'eta1',
LAMBDA = matrix(1))
check <- ctCoverageCheck(ctstantestdat, model, niter = 100,
fitArgs = list(
hessian = list(optimcontrol = list(uncertainty = 'hessian')),
bootstrap = list(optimcontrol = list(uncertainty = 'bootstrap'))),
cores = 4)
} # }