"SimResult"
: Simulation Result ObjectThis class will save data analysis results from multiple replications, such as fit indices cutoffs or power, parameter values, model misspecification, etc.
Objects can be created by sim
.
modelType
:Analysis model type (CFA, Path, or SEM)
nRep
:Number of replications have been created and run simulated data.
coef
:Parameter estimates from each replication
se
:Standard errors of parameter estimates from each replication
fit
:Fit Indices values from each replication
converged
:The convergence status of each replication: 0 = convergent, 1 = not convergent, 2 = nonconvergent in multiple imputed results, 3 = improper solutions for SE (less than 0 or NA), 4 = converged with improper solution for latent or observed (residual) covariance matrix (i.e., nonpositive definite, possible due to a Heywood case). For multiple imputations, these codes are applied when the proporion of imputed data sets with that characteristic is below the convergentCutoff
threshold (see linkS4class{SimMissing}
). For OpenMx
analyses only, a code "7" indicates Optimal estimates could not be obtained ("Status 6" in OpenMx
).
seed
:integer
used to set the seed for the L'Ecuyer-CMRG pseudorandom number generator.
paramValue
:Population model underlying each simulated dataset.
stdParamValue
:Standardized parameters of the population model underlying each simulated dataset.
paramOnly
:If TRUE
, the result object saves only population characteristics and do not save sample characteristics (e.g., parameter estimates and standard errors.
misspecValue
:Misspecified-parameter values that are imposed on the population model in each replication.
popFit
:The amount of population misfit. See details at summaryMisspec
FMI1
:Fraction Missing Method 1.
FMI2
:Fraction Missing Method 2.
cilower
:Lower bounds of confidence interval.
ciupper
:Upper bounds of confidence interval.
stdCoef
:Standardized coefficients from each replication
stdSe
:Standard Errors of Standardized coefficients from each replication
n
:The total sample size of the analyzed data.
nobs
:The sample size within each group.
pmMCAR
:Percent missing completely at random.
pmMAR
:Percent missing at random.
extraOut
:Extra outputs obtained from running the function specified in outfun
argument in the sim
function.
timing
:Time elapsed in each phase of the simulation.
The following methods are listed alphabetically. More details can be found by following the link of each method.
anova
to find the averages of model fit statistics and indices for nested models, as well as the differences of model fit indices among models. This function requires at least two SimResult
objects.
coef
to extract parameter estimates of each replication
findCoverage
to find a value of independent variables (e.g., sample size) that provides a given value of coverage rate.
findPower
to find a value of independent variables (e.g., sample size) that provides a given value of power of a parameter estimate.
getCoverage
to get the coverage rate of the confidence interval of each parameter estimate
getCIwidth
to get a median or percentile rank (assurance) of confidence interval widths of parameters estimates
getCutoff
to get the cutoff of fit indices based on a priori alpha level.
getCutoffNested
to get the cutoff of the difference in fit indices of nested models based on a priori alpha level.
getCutoffNonNested
to get the cutoff of the difference in fit indices of nonnested models based on a priori alpha level.
getExtraOutput
to get extra outputs that users requested before running a simulation
getPopulation
to get population parameter values underlying each dataset
getPower
to get the power of each parameter estimate
getPowerFit
to get the power in rejecting alternative models based on absolute model fit cutoff.
getPowerFitNested
to get the power in rejecting alternative models based on the difference between model fit cutoffs of nested models.
getPowerFitNonNested
to get the power in rejecting alternative models based on the difference between model fit cutoffs of nonnested models.
inspect
Extract target information from the simulation result. The available information is listed in this link
likRatioFit
to find the likelihood ratio (or Bayes factor) based on the bivariate distribution of fit indices
plotCoverage
to plot the coverage rate of confidence interval of parameter estimates
plotCIwidth
to plot confidence interval widths with a line of a median or percentile rank (assurance)
plotCutoff
to plot sampling distributions of fit indices with an option to draw fit indices cutoffs by specifying a priori alpha level.
plotCutoffNested
to plot sampling distributions of the difference in fit indices between nested models with an option to draw fit indices cutoffs by specifying a priori alpha level.
plotCutoffNonNested
to plot sampling distributions of the difference in fit indices between nonnested models with an option to draw fit indices cutoffs by specifying a priori alpha level.
plotMisfit
to visualize the population misfit and misspecified parameter values
plotPower
to plot power of parameter estimates
plotPowerFit
to plot the power in rejecting alternative models based on absolute model fit cutoff.
plotPowerFitNested
to plot the power in rejecting alternative models based on the difference between model fit cutoffs of nested models.
plotPowerFitNonNested
to plot the power in rejecting alternative models based on the difference between model fit cutoffs of nonnested models.
pValue
to find a p-value in comparing sample fit indices with the null sampling distribution of fit indices
pValueNested
to find a p-value in comparing the difference in sample fit indices between nested models with the null sampling distribution of the difference in fit indices
pValueNonNested
to find a p-value in comparing the difference in sample fit indices between nonnested models with the null sampling distribution of the difference in fit indices
setPopulation
to set population model for computing bias
summary
to summarize the result output
summaryConverge
to provide a head-to-head comparison between the characteristics of convergent and nonconvergent replications
summaryMisspec
to provide a summary of model misfit
summaryParam
to summarize all parameter estimates
summaryPopulation
to summarize the data generation population underlying the simulation study.
summarySeed
to provide a summary of the seed number in the simulation
summaryShort
to provide a short summary of the result output
summaryTime
to provide a summary of time elapsed in the simulation
sim
for the constructor of this class
# NOT RUN {
showClass("SimResult")
loading <- matrix(0, 6, 1)
loading[1:6, 1] <- NA
LY <- bind(loading, 0.7)
RPS <- binds(diag(1))
RTE <- binds(diag(6))
CFA.Model <- model(LY = LY, RPS = RPS, RTE = RTE, modelType="CFA")
# We make the examples running only 5 replications to save time.
# In reality, more replications are needed.
Output <- sim(5, n=500, CFA.Model)
# Summary the simulation result
summary(Output)
# Short summary of the simulation result
summaryShort(Output)
# Find the fit index cutoff
getCutoff(Output, 0.05)
# Summary of parameter estimates
summaryParam(Output)
# Summary of population parameters
summaryPopulation(Output)
# }
Run the code above in your browser using DataLab