Description Objects from the Class Slots Methods Author(s) See Also Examples
This 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
Sunthud Pornprasertmanit (psunthud@gmail.com)
sim
for the constructor of this class
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 | 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)
|
Loading required package: lavaan
This is lavaan 0.6-7
lavaan is BETA software! Please report any bugs.
#################################################################
This is simsem 0.5-15
simsem is BETA software! Please report any bugs.
simsem was first developed at the University of Kansas Center for
Research Methods and Data Analysis, under NSF Grant 1053160.
#################################################################
Attaching package: ‘simsem’
The following object is masked from ‘package:lavaan’:
inspect
Class "SimResult" [package "simsem"]
Slots:
Name: modelType nRep coef se fit
Class: character numeric data.frame data.frame data.frame
Name: converged paramValue stdParamValue misspecValue popFit
Class: vector data.frame data.frame data.frame data.frame
Name: FMI1 FMI2 cilower ciupper stdCoef
Class: data.frame data.frame data.frame data.frame data.frame
Name: stdSe seed n nobs pmMCAR
Class: data.frame numeric vector data.frame vector
Name: pmMAR extraOut paramOnly timing
Class: vector list logical list
Progress: 1 / 5
Progress: 2 / 5
Progress: 3 / 5
Progress: 4 / 5
Progress: 5 / 5
RESULT OBJECT
Model Type
[1] "cfa"
========= Fit Indices Cutoffs ============
Alpha
Fit Indices 0.1 0.05 0.01 0.001 Mean SD
chisq 12.264 13.282 14.097 14.281 9.520 2.755
aic 7492.545 7493.877 7494.942 7495.182 7439.859 63.769
bic 7568.408 7569.740 7570.805 7571.045 7515.722 63.769
rmsea 0.023 0.029 0.033 0.034 0.008 0.015
cfi 0.996 0.995 0.994 0.994 0.999 0.003
tli 0.994 0.992 0.991 0.990 0.999 0.005
srmr 0.016 0.017 0.018 0.018 0.014 0.002
========= Parameter Estimates and Standard Errors ============
Estimate Average Estimate SD Average SE Power (Not equal 0) Std Est
f1=~y1 0.648 0.048 0.042 1 0.664
f1=~y2 0.674 0.040 0.042 1 0.680
f1=~y3 0.710 0.054 0.041 1 0.719
f1=~y4 0.696 0.058 0.041 1 0.704
f1=~y5 0.681 0.075 0.042 1 0.688
f1=~y6 0.672 0.043 0.042 1 0.681
y1~~y1 0.528 0.029 0.039 1 0.558
y2~~y2 0.526 0.020 0.040 1 0.537
y3~~y3 0.467 0.046 0.037 1 0.481
y4~~y4 0.489 0.016 0.038 1 0.504
y5~~y5 0.510 0.018 0.039 1 0.526
y6~~y6 0.518 0.033 0.039 1 0.535
y1~1 -0.042 0.008 0.044 0 -0.043
y2~1 -0.032 0.026 0.044 0 -0.033
y3~1 0.011 0.031 0.044 0 0.011
y4~1 -0.028 0.043 0.044 0 -0.027
y5~1 -0.010 0.065 0.044 0 -0.011
y6~1 -0.015 0.059 0.044 0 -0.016
Std Est SD Std Ave SE Average Param Average Bias Coverage
f1=~y1 0.029 0.030 0.70 -0.052 0.8
f1=~y2 0.026 0.029 0.70 -0.026 1.0
f1=~y3 0.037 0.027 0.70 0.010 0.8
f1=~y4 0.027 0.028 0.70 -0.004 0.8
f1=~y5 0.039 0.028 0.70 -0.019 0.6
f1=~y6 0.028 0.029 0.70 -0.028 1.0
y1~~y1 0.039 0.039 0.51 0.018 1.0
y2~~y2 0.035 0.039 0.51 0.016 1.0
y3~~y3 0.053 0.038 0.51 -0.043 0.8
y4~~y4 0.038 0.039 0.51 -0.021 1.0
y5~~y5 0.054 0.039 0.51 0.000 1.0
y6~~y6 0.038 0.039 0.51 0.008 1.0
y1~1 0.008 0.045 0.00 -0.042 1.0
y2~1 0.026 0.045 0.00 -0.032 1.0
y3~1 0.032 0.045 0.00 0.011 1.0
y4~1 0.042 0.045 0.00 -0.028 1.0
y5~1 0.067 0.045 0.00 -0.010 1.0
y6~1 0.061 0.045 0.00 -0.015 1.0
========= Correlation between Fit Indices ============
chisq aic bic rmsea cfi tli srmr
chisq 1.000 -0.282 -0.282 0.988 -0.976 -0.999 0.966
aic -0.282 1.000 1.000 -0.319 0.166 0.263 -0.374
bic -0.282 1.000 1.000 -0.319 0.166 0.263 -0.374
rmsea 0.988 -0.319 -0.319 1.000 -0.987 -0.986 0.981
cfi -0.976 0.166 0.166 -0.987 1.000 0.977 -0.965
tli -0.999 0.263 0.263 -0.986 0.977 1.000 -0.958
srmr 0.966 -0.374 -0.374 0.981 -0.965 -0.958 1.000
================== Replications =====================
Number of replications = 5
Number of converged replications = 5
Number of nonconverged replications:
1. Nonconvergent Results = 0
2. Nonconvergent results from multiple imputation = 0
3. At least one SE were negative or NA = 0
4. At least one variance estimates were negative = 0
5. At least one correlation estimates were greater than 1 or less than -1 = 0
6. Model-implied covariance matrices of any groups of latent variables are not positive definite = 0
RESULT OBJECT
[1] "cfa"
Model Type: cfa
Convergence 5 / 5
Sample size: 500
Percent Completely Missing at Random: 0
Percent Missing at Random: 0
========= Fit Indices Cutoffs ============
Alpha
Fit Indices 0.05 Mean SD
chisq 13.282 9.520 2.755
aic 7493.877 7439.859 63.769
bic 7569.740 7515.722 63.769
rmsea 0.029 0.008 0.015
cfi 0.995 0.999 0.003
tli 0.992 0.999 0.005
srmr 0.017 0.014 0.002
chisq aic bic rmsea cfi tli srmr
95% 13.28247 7493.877 7569.74 0.02881863 0.9953228 0.9922047 0.01702757
Estimate Average Estimate SD Average SE Power (Not equal 0) Std Est
f1=~y1 0.64769347 0.047633792 0.04152994 1 0.66443090
f1=~y2 0.67410365 0.039784006 0.04197009 1 0.68003224
f1=~y3 0.70962059 0.053933926 0.04101338 1 0.71933877
f1=~y4 0.69587656 0.057541606 0.04136722 1 0.70406733
f1=~y5 0.68077522 0.074956208 0.04166100 1 0.68779081
f1=~y6 0.67152361 0.042907043 0.04170321 1 0.68148099
y1~~y1 0.52821328 0.028904477 0.03909841 1 0.55784320
y2~~y2 0.52625967 0.020207669 0.03956792 1 0.53702484
y3~~y3 0.46690998 0.046045804 0.03686850 1 0.48147618
y4~~y4 0.48912047 0.015610947 0.03790651 1 0.50372730
y5~~y5 0.50960273 0.017969772 0.03877970 1 0.52573342
y6~~y6 0.51831050 0.033075434 0.03910778 1 0.53496217
y1~1 -0.04168278 0.007929115 0.04355652 0 -0.04273744
y2~1 -0.03239567 0.025848733 0.04430591 0 -0.03304879
y3~1 0.01099607 0.030823321 0.04408538 0 0.01123800
y4~1 -0.02810014 0.042865901 0.04414599 0 -0.02735015
y5~1 -0.01049442 0.064670892 0.04416644 0 -0.01058453
y6~1 -0.01510456 0.059148091 0.04404404 0 -0.01574890
Std Est SD Std Ave SE Average Param Average Bias Coverage
f1=~y1 0.029333801 0.02972991 0.70 -0.0523065323 0.8
f1=~y2 0.025771089 0.02889890 0.70 -0.0258963462 1.0
f1=~y3 0.036666589 0.02672021 0.70 0.0096205854 0.8
f1=~y4 0.026502082 0.02760399 0.70 -0.0041234442 0.8
f1=~y5 0.038897084 0.02846897 0.70 -0.0192247765 0.6
f1=~y6 0.027872231 0.02884983 0.70 -0.0284763883 1.0
y1~~y1 0.039228053 0.03940489 0.51 0.0182132773 1.0
y2~~y2 0.035065889 0.03922481 0.51 0.0162596737 1.0
y3~~y3 0.052848397 0.03828097 0.51 -0.0430900220 0.8
y4~~y4 0.037901166 0.03879579 0.51 -0.0208795314 1.0
y5~~y5 0.054338806 0.03900646 0.51 -0.0003972686 1.0
y6~~y6 0.037825683 0.03925652 0.51 0.0083104954 1.0
y1~1 0.007732284 0.04474231 0.00 -0.0416827795 1.0
y2~1 0.026350478 0.04473977 0.00 -0.0323956700 1.0
y3~1 0.031769962 0.04473180 0.00 0.0109960673 1.0
y4~1 0.042192605 0.04474563 0.00 -0.0281001441 1.0
y5~1 0.066912851 0.04476263 0.00 -0.0104944232 1.0
y6~1 0.060600318 0.04475696 0.00 -0.0151045607 1.0
f1=~y1 f1=~y2 f1=~y3 f1=~y4 f1=~y5 f1=~y6 y1~~y1 y2~~y2 y3~~y3
Population Value 0.7 0.7 0.7 0.7 0.7 0.7 0.51 0.51 0.51
y4~~y4 y5~~y5 y6~~y6 y1~1 y2~1 y3~1 y4~1 y5~1 y6~1
Population Value 0.51 0.51 0.51 0 0 0 0 0 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.