Description Usage Arguments Value Author(s) See Also Examples
View source: R/summarySimResult.R
This function will set the data generation population model to be an appropriate one. If the appropriate data generation model is specified, the additional features can be seen in summary
or summaryParam
functions on the target object, such as bias in parameter estimates or percentage coverage.
1 | setPopulation(target, population)
|
target |
The result object that you wish to set the data generation population model ( |
population |
The population parameters specified in the |
The target object that is changed the parameter.
Sunthud Pornprasertmanit (psunthud@gmail.com)
SimResult
for result object
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | # See each class for an example.
## Not run:
# Data generation model
loading <- matrix(0, 7, 3)
loading[1:3, 1] <- NA
loading[4:6, 2] <- NA
loading[1:7, 3] <- NA
loadingVal <- matrix(0, 7, 3)
loadingVal[1:3, 1] <- "runif(1, 0.5, 0.7)"
loadingVal[4:6, 2] <- "runif(1, 0.5, 0.7)"
loadingVal[1:6, 3] <- "runif(1, 0.3, 0.5)"
loadingVal[7, 3] <- 1
loading.mis <- matrix("runif(1, -0.2, 0.2)", 7, 3)
loading.mis[is.na(loading)] <- 0
loading.mis[,3] <- 0
loading.mis[7,] <- 0
LY <- bind(loading, loadingVal, misspec=loading.mis)
RPS <- binds(diag(3))
path <- matrix(0, 3, 3)
path[2, 1] <- NA
BE <- bind(path, "runif(1, 0.3, 0.5)")
RTE <- binds(diag(7))
VY <- bind(c(rep(NA, 6), 0), c(rep(1, 6), ""))
datamodel <- model(LY=LY, RPS=RPS, BE=BE, RTE=RTE, VY=VY, modelType="SEM")
# Data analysis model
loading <- matrix(0, 7, 3)
loading[1:3, 1] <- NA
loading[4:6, 2] <- NA
loading[7, 3] <- NA
path <- matrix(0, 3, 3)
path[2, 1] <- NA
path[1, 3] <- NA
path[2, 3] <- NA
errorCov <- diag(NA, 7)
errorCov[7, 7] <- 0
facCov <- diag(3)
analysis <- estmodel(LY=loading, BE=path, TE=errorCov, PS=facCov, modelType="SEM",
indLab=paste("y", 1:7, sep=""))
# In reality, more than 10 replications are needed.
Output <- sim(10, n=200, analysis, generate=datamodel)
# Population
loadingVal <- matrix(0, 7, 3)
loadingVal[1:3, 1] <- 0.6
loadingVal[4:6, 2] <- 0.6
loadingVal[7, 3] <- 1
LY <- bind(loading, loadingVal)
pathVal <- matrix(0, 3, 3)
pathVal[2, 1] <- 0.4
pathVal[1, 3] <- 0.4
pathVal[2, 3] <- 0.4
BE <- bind(path, pathVal)
PS <- binds(facCov)
errorCovVal <- diag(0.64, 7)
errorCovVal[7, 7] <- 0
TE <- binds(errorCov, errorCovVal)
population <- model(LY=LY, PS=PS, BE=BE, TE=TE, modelType="SEM")
# Set up the new population
Output2 <- setPopulation(Output, population)
# This summary will contain the bias information
summary(Output2)
## End(Not run)
|
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
Progress: 1 / 10
Progress: 2 / 10
Progress: 3 / 10
Progress: 4 / 10
Progress: 5 / 10
Progress: 6 / 10
Progress: 7 / 10
Progress: 8 / 10
Progress: 9 / 10
Progress: 10 / 10
RESULT OBJECT
Model Type
[1] "sem"
========= Fit Indices Cutoffs ============
Alpha
Fit Indices 0.1 0.05 0.01 0.001 Mean SD
chisq 46.711 47.515 48.159 48.303 31.317 13.412
aic 3636.572 3645.710 3653.020 3654.665 3556.028 55.861
bic 3712.433 3721.571 3728.881 3730.526 3631.889 55.861
rmsea 0.120 0.122 0.123 0.123 0.082 0.039
cfi 0.934 0.932 0.931 0.931 0.959 0.024
tli 0.884 0.881 0.879 0.878 0.930 0.044
srmr 0.056 0.057 0.058 0.058 0.044 0.010
========= Parameter Estimates and Standard Errors ============
Estimate Average Estimate SD Average SE Power (Not equal 0) Std Est
f1=~y1 0.555 0.067 0.061 1.0 0.673
f1=~y2 0.551 0.106 0.058 1.0 0.699
f1=~y3 0.627 0.098 0.061 1.0 0.757
f2=~y4 0.544 0.074 0.059 1.0 0.717
f2=~y5 0.512 0.111 0.057 1.0 0.684
f2=~y6 0.570 0.106 0.059 1.0 0.756
f3=~y7 1.007 0.048 0.050 1.0 1.000
y1~~y1 0.550 0.147 0.072 1.0 0.539
y2~~y2 0.452 0.116 0.064 1.0 0.502
y3~~y3 0.422 0.130 0.069 0.9 0.421
y4~~y4 0.484 0.154 0.068 1.0 0.477
y5~~y5 0.501 0.111 0.067 1.0 0.522
y6~~y6 0.408 0.139 0.067 1.0 0.420
f2~f1 0.380 0.267 0.118 0.7 0.330
f1~f3 0.693 0.091 0.105 1.0 0.567
f2~f3 0.496 0.162 0.123 1.0 0.376
y1~1 0.008 0.062 0.071 0.0 0.007
y2~1 -0.011 0.060 0.067 0.1 -0.011
y3~1 -0.038 0.091 0.071 0.1 -0.037
y4~1 0.010 0.074 0.071 0.1 0.010
y5~1 -0.019 0.073 0.069 0.0 -0.020
y6~1 0.019 0.047 0.070 0.0 0.019
y7~1 -0.009 0.060 0.071 0.0 -0.010
Std Est SD Std Ave SE Average Param Average Bias Coverage
f1=~y1 0.091 0.051 0.60 -0.045 0.9
f1=~y2 0.100 0.049 0.60 -0.049 0.5
f1=~y3 0.087 0.046 0.60 0.027 0.8
f2=~y4 0.101 0.047 0.60 -0.056 0.9
f2=~y5 0.104 0.049 0.60 -0.088 0.6
f2=~y6 0.099 0.046 0.60 -0.030 0.8
f3=~y7 0.000 0.000 1.00 0.007 1.0
y1~~y1 0.121 0.067 0.64 -0.090 0.5
y2~~y2 0.143 0.068 0.64 -0.188 0.4
y3~~y3 0.135 0.069 0.64 -0.218 0.2
y4~~y4 0.153 0.065 0.64 -0.156 0.6
y5~~y5 0.133 0.066 0.64 -0.139 0.5
y6~~y6 0.151 0.068 0.64 -0.232 0.4
f2~f1 0.203 0.093 0.40 -0.020 0.6
f1~f3 0.048 0.058 0.40 0.293 0.1
f2~f3 0.130 0.084 0.40 0.096 0.8
y1~1 0.061 0.071 0.00 0.008 1.0
y2~1 0.062 0.071 0.00 -0.011 0.9
y3~1 0.090 0.071 0.00 -0.038 0.9
y4~1 0.075 0.071 0.00 0.010 0.9
y5~1 0.075 0.071 0.00 -0.019 1.0
y6~1 0.047 0.071 0.00 0.019 1.0
y7~1 0.061 0.071 0.00 -0.009 1.0
========= Correlation between Fit Indices ============
chisq aic bic rmsea cfi tli srmr
chisq 1.000 -0.383 -0.383 0.969 -0.972 -0.969 0.813
aic -0.383 1.000 1.000 -0.283 0.230 0.213 -0.150
bic -0.383 1.000 1.000 -0.283 0.230 0.213 -0.150
rmsea 0.969 -0.283 -0.283 1.000 -0.963 -0.975 0.831
cfi -0.972 0.230 0.230 -0.963 1.000 0.998 -0.868
tli -0.969 0.213 0.213 -0.975 0.998 1.000 -0.870
srmr 0.813 -0.150 -0.150 0.831 -0.868 -0.870 1.000
================== Replications =====================
Number of replications = 10
Number of converged replications = 10
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.