Last updated: 2020-06-01
Checks: 6 1
Knit directory: mcfa-para-est/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown is untracked by Git. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish
to commit the R Markdown file and build the HTML.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20190614)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version eecb366. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: data/compiled_para_results.txt
Ignored: data/results_bias_est.csv
Ignored: data/results_bias_se.csv
Ignored: fig/
Ignored: manuscript/
Ignored: output/fact-cov-converge-largeN.pdf
Ignored: output/fact-cov-converge-medN.pdf
Ignored: output/fact-cov-converge-smallN.pdf
Ignored: output/loading-converge-largeN.pdf
Ignored: output/loading-converge-medN.pdf
Ignored: output/loading-converge-smallN.pdf
Ignored: references/
Ignored: sera-presentation/
Untracked files:
Untracked: analysis/ml-cfa-parameter-anova-estimates.Rmd
Untracked: analysis/ml-cfa-parameter-anova-relative-bias.Rmd
Untracked: analysis/ml-cfa-parameter-bias-latent-ICC.Rmd
Untracked: analysis/ml-cfa-parameter-bias-observed-ICC.Rmd
Untracked: analysis/ml-cfa-parameter-convergence-correlation-pubfigure.Rmd
Untracked: analysis/ml-cfa-parameter-convergence-trace-plots-factor-loadings.Rmd
Untracked: analysis/ml-cfa-standard-error-anova-logSE.Rmd
Untracked: analysis/ml-cfa-standard-error-anova-relative-bias.Rmd
Untracked: analysis/ml-cfa-standard-error-bias-factor-loadings.Rmd
Untracked: analysis/ml-cfa-standard-error-bias-overview.Rmd
Untracked: code/r_functions.R
Unstaged changes:
Modified: analysis/index.Rmd
Modified: analysis/ml-cfa-parameter-convergence-correlation-factor-loadings.Rmd
Modified: code/get_data.R
Modified: code/load_packages.R
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
There are no past versions. Publish this analysis with wflow_publish()
to start tracking its development.
rm(list=ls())
source(paste0(getwd(),"/code/load_packages.R"))
#source(paste0(getwd(),"/code/get_data.R"))
sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] xtable_1.8-4 kableExtra_1.1.0 cowplot_1.0.0
[4] MplusAutomation_0.7-3 data.table_1.12.8 patchwork_1.0.0
[7] forcats_0.5.0 stringr_1.4.0 dplyr_0.8.5
[10] purrr_0.3.4 readr_1.3.1 tidyr_1.1.0
[13] tibble_3.0.1 ggplot2_3.3.0 tidyverse_1.3.0
[16] workflowr_1.6.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 lubridate_1.7.8 lattice_0.20-38 assertthat_0.2.1
[5] rprojroot_1.3-2 digest_0.6.25 R6_2.4.1 cellranger_1.1.0
[9] plyr_1.8.6 backports_1.1.7 reprex_0.3.0 evaluate_0.14
[13] coda_0.19-3 httr_1.4.1 pillar_1.4.4 rlang_0.4.6
[17] readxl_1.3.1 rstudioapi_0.11 blob_1.2.1 texreg_1.36.23
[21] gsubfn_0.7 rmarkdown_2.1 proto_1.0.0 webshot_0.5.2
[25] pander_0.6.3 munsell_0.5.0 broom_0.5.6 compiler_3.6.3
[29] httpuv_1.5.2 modelr_0.1.8 xfun_0.14 pkgconfig_2.0.3
[33] htmltools_0.4.0 tidyselect_1.1.0 viridisLite_0.3.0 fansi_0.4.1
[37] crayon_1.3.4 dbplyr_1.4.4 withr_2.2.0 later_1.0.0
[41] grid_3.6.3 nlme_3.1-144 jsonlite_1.6.1 gtable_0.3.0
[45] lifecycle_0.2.0 DBI_1.1.0 git2r_0.27.1 magrittr_1.5
[49] scales_1.1.1 cli_2.0.2 stringi_1.4.6 fs_1.4.1
[53] promises_1.1.0 xml2_1.3.2 ellipsis_0.3.1 generics_0.0.2
[57] vctrs_0.3.0 boot_1.3-24 tools_3.6.3 glue_1.4.1
[61] hms_0.5.3 parallel_3.6.3 yaml_2.2.1 colorspace_1.4-1
[65] rvest_0.3.5 knitr_1.28 haven_2.3.0
# general options
theme_set(theme_bw())
options(digits=3)
# set up vectors of variable names
pvec <- c(paste0('lambda1',1:6), paste0('lambda2',6:10), 'psiW12','psiB1', 'psiB2', 'psiB12', paste0('thetaB',1:10), 'icc_lv1_est', 'icc_lv2_est', paste0('icc_ov',1:10,'_est'))
# stored "true" values of parameters by each condition
ptvec <- c(rep('lambdaT',11), 'psiW12T', 'psiB1T', 'psiB2T', 'psiB12T', rep("thetaBT", 10), rep('icc_lv',2), rep('icc_ov',10))
result <- read_csv(paste0(w.d, "/data/results_bias_est.csv"))
Parsed with column specification:
cols(
N1 = col_double(),
N2 = col_double(),
ICC_LV = col_double(),
ICC_OV = col_double(),
Variable = col_character(),
Estimator = col_character(),
TrueValue = col_double(),
RB = col_double(),
RMSE = col_double(),
Bias = col_double(),
SampVar = col_double(),
muRE = col_double(),
mwRE = col_double(),
uwRE = col_double(),
nRep = col_double(),
estMean = col_double(),
estSD = col_double()
)
# Set conditions levels as categorical values
result <- result %>%
mutate(N1 = factor(N1, c("5", "10", "30")),
N2 = factor(N2, c("30", "50", "100", "200")),
ICC_OV = factor(ICC_OV, c("0.1","0.3", "0.5")),
ICC_LV = factor(ICC_LV, c("0.1", "0.5")),
wi = nRep/500)
First, we will plot estimates (botxplots) to show how these estimates changed across conditions. To summarize the results we will average over the parameters that only differ y indices. Meaning we will describe the “average factor loading bias” by reporting the average bias for factor loadings. Additionally, different conditions resultedin different “sample sizes.” By this we mean the number of uses replications. The different number of cases per condition was accounted for by creating a “weight” variable for each row of the result
object. This meant that conditions that had more usable replications counted more towards to averages reported (or count as much as if we averaged over the individual replications).
sdat <- filter(result, Variable %like% 'icc_lv')
sdat <- sdat %>%
group_by(N1, N2, ICC_OV, ICC_LV, Estimator) %>%
summarise(estMean = weighted.mean(estMean, wi),
estSD = weighted.mean(estSD, wi),
RB = weighted.mean(RB, wi),
RMSE = weighted.mean(RMSE, wi),
Bias = weighted.mean(Bias, wi),
SampVar = weighted.mean(SampVar, wi))
# first, plot estimates
p1 <- ggplot(sdat, aes(y=estMean))+
geom_boxplot()+
labs(y="Average Latent Variable ICC")
p2 <- ggplot(sdat, aes(y=estSD))+
geom_boxplot()+
labs(y="SD of Latent Variable ICC")
p3 <- ggplot(sdat, aes(y=RB))+
geom_boxplot()+
geom_hline(yintercept=-10, color="red", linetype="dashed")+
geom_hline(yintercept=10, color="red", linetype="dashed")+
labs(y="Relative Bias")
p4 <- ggplot(sdat, aes(y=RMSE))+
geom_boxplot()+
labs(y="Root Mean Square Error")
p5 <- ggplot(sdat, aes(y=Bias))+
geom_boxplot()+
labs(y="Sqaured Bias")
p6 <- ggplot(sdat, aes(y=SampVar))+
geom_boxplot()+
labs(y="Sampling Variance of Estimates")
p <- (p1 + p2 + p3)/(p4 + p5 + p6) +
plot_annotation(title="Summarizing bias indices of LATENT VARIABLE ICC")
p
ggplot(sdat, aes(y=estMean))+
geom_boxplot()+
labs(y="Average Latent Variable ICC",
title="LATENT VARIABLE ICC by Estimation Method",
subtitle="Parameter Estimates")+
facet_wrap(.~Estimator)
ggplot(sdat, aes(y=estSD))+
geom_boxplot()+
labs(y="SD of Latent Variable ICC",
title="LATENT VARIABLE ICC by Estimation Method",
subtitle="Standard Deviation of Estimates")+
facet_wrap(.~Estimator)
ggplot(sdat, aes(y=RB))+
geom_boxplot()+
geom_hline(yintercept=-10, color="red", linetype="dashed")+
geom_hline(yintercept=10, color="red", linetype="dashed")+
labs(y="Relative Bias",
title="LATENT VARIABLE ICC by Estimation Method",
subtitle="Relative Bias of Estimates")+
facet_wrap(.~Estimator)
ggplot(sdat, aes(y=RMSE))+
geom_boxplot()+
labs(y="Root Mean Square Error",
title="LATENT VARIABLE ICC by Estimation Method",
subtitle="Root Mean Square Error of Estimates")+
facet_wrap(.~Estimator)
ggplot(sdat, aes(y=Bias))+
geom_boxplot()+
labs(y="Sqaured Bias",
title="LATENT VARIABLE ICC by Estimation Method",
subtitle="Squared Bias of Estiamtes")+
facet_wrap(.~Estimator)
ggplot(sdat, aes(y=SampVar))+
geom_boxplot()+
labs(y="Sampling Variance",
title="LATENT VARIABLE ICC by Estimation Method",
subtitle="Sampling Variance of Estimates")+
facet_wrap(.~Estimator)
c <- sdat %>%
group_by(Estimator) %>%
summarise(est = mean(estMean),
RB = mean(RB),
RMSE = mean(RMSE),
Bias = mean(Bias),
SampVar =mean(SampVar))
kable(c, format='html', digits=3,
caption="Summary Indices of LATENT VARIABLE ICC by Estimation Method") %>%
kable_styling(full_width = T)
Estimator | est | RB | RMSE | Bias | SampVar |
---|---|---|---|---|---|
MLR | 0.303 | 8.218 | 0.006 | 0.001 | 0.006 |
ULSMV | 0.308 | 9.481 | 0.007 | 0.001 | 0.006 |
WLSMV | 0.287 | -0.585 | 0.007 | 0.001 | 0.006 |
ggplot(sdat, aes(y=estMean))+
geom_boxplot()+
labs(y="Average Latent Variable ICC",
title="LATENT VARIABLE ICC by Level-2 Sample Size",
subtitle="Parameter Estimates")+
facet_wrap(.~N2)
ggplot(sdat, aes(y=estSD))+
geom_boxplot()+
labs(y="SD of Latent Variable ICC",
title="LATENT VARIABLE ICC by Level-2 Sample Size",
subtitle="Standard Deviation of Parameter Estimates")+
facet_wrap(.~N2)
ggplot(sdat, aes(y=RB))+
geom_boxplot()+
geom_hline(yintercept=-10, color="red", linetype="dashed")+
geom_hline(yintercept=10, color="red", linetype="dashed")+
labs(y="Relative Bias",
title="LATENT VARIABLE ICC by Level-2 Sample Size",
subtitle="Relative Bias Parameter Estimates")+
facet_wrap(.~N2)
ggplot(sdat, aes(y=RMSE))+
geom_boxplot()+
labs(y="Root Mean Square Error",
title="LATENT VARIABLE ICC by Level-2 Sample Size",
subtitle="Root Mean Square Error")+
facet_wrap(.~N2)
ggplot(sdat, aes(y=Bias))+
geom_boxplot()+
labs(y="Sqaured Bias",
title="LATENT VARIABLE ICC by Level-2 Sample Size",
subtitle="Squared Bias of Parameter Estimates")+
facet_wrap(.~N2)
ggplot(sdat, aes(y=SampVar))+
geom_boxplot()+
labs(y="Sampling Variance of Estimates",
title="LATENT VARIABLE ICC by Level-2 Sample Size",
subtitle="Sampling Variance of Parameter Estimates")+
facet_wrap(.~N2)
c <- sdat %>%
group_by(N2) %>%
summarise(est = mean(estMean),
RB = mean(RB),
RMSE = mean(RMSE),
Bias = mean(Bias),
SampVar =mean(SampVar))
kable(c, format='html', digits=3,
caption="Summary Indices of LATENT VARIABLE ICC by Level-2 Sample Size") %>%
kable_styling(full_width = T)
N2 | est | RB | RMSE | Bias | SampVar |
---|---|---|---|---|---|
30 | 0.300 | 12.084 | 0.013 | 0.002 | 0.011 |
50 | 0.299 | 7.252 | 0.008 | 0.001 | 0.007 |
100 | 0.300 | 3.188 | 0.004 | 0.000 | 0.004 |
200 | 0.299 | 0.295 | 0.002 | 0.000 | 0.002 |
ggplot(sdat, aes(y=estMean))+
geom_boxplot()+
labs(y="Average Latent Variable ICC",
title="LATENT VARIABLE ICC by Level-1",
subtitle="Parameter Estimates")+
facet_wrap(.~N1)
ggplot(sdat, aes(y=estSD))+
geom_boxplot()+
labs(y="SD of Latent Variable ICC",
title="LATENT VARIABLE ICC by Level-1 Sample Size",
subtitle="Standard Deviation of Parameter Estimates")+
facet_wrap(.~N1)
ggplot(sdat, aes(y=RB))+
geom_boxplot()+
geom_hline(yintercept=-10, color="red", linetype="dashed")+
geom_hline(yintercept=10, color="red", linetype="dashed")+
labs(y="Relative Bias",
title="LATENT VARIABLE ICC by Level-1 Sample Size",
subtitle="Relative Bias of Parameter Estimates")+
facet_wrap(.~N1)
ggplot(sdat, aes(y=RMSE))+
geom_boxplot()+
labs(y="Root Mean Square Error",
title="LATENT VARIABLE ICC by Level-1 Sample Size",
subtitle="Root Mean Square Error")+
facet_wrap(.~N1)
ggplot(sdat, aes(y=Bias))+
geom_boxplot()+
labs(y="Sqaured Bias",
title="LATENT VARIABLE ICC by Level-1 Sample Size",
subtitle="Squared Bias of Parameter Estimates")+
facet_wrap(.~N1)
ggplot(sdat, aes(y=SampVar))+
geom_boxplot()+
labs(y="Sampling Variance of Estimates",
title="LATENT VARIABLE ICC by Level-1 Sample Size",
subtitle="Sampling Variance of Parameter Estimates")+
facet_wrap(.~N1)
c <- sdat %>%
group_by(N1) %>%
summarise(est = mean(estMean),
RB = mean(RB),
RMSE = mean(RMSE),
Bias = mean(Bias),
SampVar =mean(SampVar))
kable(c, format='html', digits=3,
caption="Summary Indices of LATENT VARIABLE ICC by Level-1 Sample Size") %>%
kable_styling(full_width = T)
N1 | est | RB | RMSE | Bias | SampVar |
---|---|---|---|---|---|
5 | 0.302 | 9.76 | 0.009 | 0.001 | 0.008 |
10 | 0.298 | 4.43 | 0.006 | 0.001 | 0.005 |
30 | 0.298 | 2.92 | 0.004 | 0.000 | 0.004 |
ggplot(sdat, aes(y=estMean))+
geom_boxplot()+
labs(y="Average Latent Variable ICC",
title="LATENT VARIABLE ICC by ICC of Observed Variables",
subtitle="Parameter Estimates")+
facet_wrap(.~ICC_OV)
ggplot(sdat, aes(y=estSD))+
geom_boxplot()+
labs(y="SD of Latent Variable ICC",
title="LATENT VARIABLE ICC by ICC of Observed Variables",
subtitle="Standard Deviation of Parameter Estimates")+
facet_wrap(.~ICC_OV)
ggplot(sdat, aes(y=RB))+
geom_boxplot()+
geom_hline(yintercept=-10, color="red", linetype="dashed")+
geom_hline(yintercept=10, color="red", linetype="dashed")+
labs(y="Relative Bias",
title="LATENT VARIABLE ICC by ICC of Observed Variables",
subtitle="Relative Bias of Parameter Estimates")+
facet_wrap(.~ICC_OV)
ggplot(sdat, aes(y=RMSE))+
geom_boxplot()+
labs(y="Root Mean Square Error",
title="LATENT VARIABLE ICC by ICC of Observed Variables",
subtitle="Root Mean Square Error of Parameter Estimates")+
facet_wrap(.~ICC_OV)
ggplot(sdat, aes(y=Bias))+
geom_boxplot()+
labs(y="Sqaured Bias",
title="LATENT VARIABLE ICC by ICC of Observed Variables",
subtitle="Squared Bias of Parameter Estimates")+
facet_wrap(.~ICC_OV)
ggplot(sdat, aes(y=SampVar))+
geom_boxplot()+
labs(y="Sampling Variance of Estimates",
title="LATENT VARIABLE ICC by ICC of Observed Variables",
subtitle="Sampling Variance of Parameter Estimates")+
facet_wrap(.~ICC_OV)
c <- sdat %>%
group_by(ICC_OV) %>%
summarise(est = mean(estMean),
RB = mean(RB),
RMSE = mean(RMSE),
Bias = mean(Bias),
SampVar =mean(SampVar))
kable(c, format='html', digits=3, caption="Summary Indices of LATENT VARIABLE ICC by ICC of Observed Variables") %>%
kable_styling(full_width = T)
ICC_OV | est | RB | RMSE | Bias | SampVar |
---|---|---|---|---|---|
0.1 | 0.289 | -4.29 | 0.004 | 0.000 | 0.003 |
0.3 | 0.297 | 3.33 | 0.006 | 0.000 | 0.005 |
0.5 | 0.311 | 18.08 | 0.010 | 0.002 | 0.008 |
ggplot(sdat, aes(y=estMean))+
geom_boxplot()+
labs(y="Average Latent Variable ICC",
title="LATENT VARIABLE ICC by ICC of Latent Variables",
subtitle="Parameter Estimates")+
facet_wrap(.~ICC_LV)
ggplot(sdat, aes(y=estSD))+
geom_boxplot()+
labs(y="SD of Latent Variable ICC",
title="LATENT VARIABLE ICC by ICC of Latent Variables",
subtitle="Standard Deviation of Parameter Estimates")+
facet_wrap(.~ICC_LV)
ggplot(sdat, aes(y=RB))+
geom_boxplot()+
geom_hline(yintercept=-10, color="red", linetype="dashed")+
geom_hline(yintercept=10, color="red", linetype="dashed")+
labs(y="Relative Bias",
title="LATENT VARIABLE ICC by ICC of Latent Variables",
subtitle="Relative Bias of Parameter Estimates")+
facet_wrap(.~ICC_LV)
ggplot(sdat, aes(y=RMSE))+
geom_boxplot()+
labs(y="Root Mean Square Error",
title="LATENT VARIABLE ICC by ICC of Latent Variables",
subtitle="Root Mean Square Error of Parameter Estimates")+
facet_wrap(.~ICC_LV)
ggplot(sdat, aes(y=Bias))+
geom_boxplot()+
labs(y="Sqaured Bias",
title="LATENT VARIABLE ICC by ICC of Latent Variables",
subtitle="Squared Bias of Parameter Estimates")+
facet_wrap(.~ICC_LV)
ggplot(sdat, aes(y=SampVar))+
geom_boxplot()+
labs(y="Sampling Variance of Estimates",
title="LATENT VARIABLE ICC by ICC of Latent Variables",
subtitle="Sampling Variance of Parameter Estimates")+
facet_wrap(.~ICC_LV)
c <- sdat %>%
group_by(ICC_LV) %>%
summarise(est = mean(estMean),
RB = mean(RB),
RMSE = mean(RMSE),
Bias = mean(Bias),
SampVar =mean(SampVar))
kable(c, format='html', digits=3,
caption="Summary Indices of LATENT VARIABLE ICC by ICC of Latent Variables") %>%
kable_styling(full_width = T)
ICC_LV | est | RB | RMSE | Bias | SampVar |
---|---|---|---|---|---|
0.1 | 0.115 | 14.68 | 0.006 | 0.001 | 0.005 |
0.5 | 0.484 | -3.27 | 0.007 | 0.001 | 0.007 |
ggplot(sdat, aes(y=estMean))+
geom_boxplot()+
labs(y="Average Latent Variable ICC")+
facet_grid(N2~Estimator)
ggplot(sdat, aes(y=RB))+
geom_boxplot()+
geom_hline(yintercept=-10, color="red", linetype="dashed")+
geom_hline(yintercept=10, color="red", linetype="dashed")+
labs(y="Relative Bias")+
facet_grid(N2~Estimator)
ggplot(sdat, aes(y=RMSE))+
geom_boxplot()+
labs(y="Root Mean Square Error")+
facet_grid(N2~Estimator)
c <- sdat %>%
group_by(Estimator, N2) %>%
summarise(est = mean(estMean),
RB = mean(RB),
RMSE = mean(RMSE),
Bias = mean(Bias),
SampVar =mean(SampVar))
c1 <- cbind(c[ c$Estimator == 'MLR', c( 'N2', 'est', 'RB', 'RMSE')],
c[ c$Estimator == 'ULSMV', c('est', 'RB', 'RMSE')],
c[ c$Estimator == 'WLSMV', c('est', 'RB', 'RMSE')])
colnames(c1) <- c('N2', rep(c('est', 'RB', 'RMSE'), 3))
kable(c1, format='html', digits=3, row.names = F) %>%
kable_styling(full_width = T) %>%
add_header_above(c(' '=1, 'MLR'=3, 'ULSMV'=3, 'WLSMV'=3))
N2 | est | RB | RMSE | est | RB | RMSE | est | RB | RMSE |
---|---|---|---|---|---|---|---|---|---|
30 | 0.307 | 16.47 | 0.012 | 0.319 | 20.55 | 0.013 | 0.273 | -0.777 | 0.013 |
50 | 0.304 | 10.57 | 0.007 | 0.308 | 10.95 | 0.008 | 0.284 | 0.230 | 0.008 |
100 | 0.302 | 4.82 | 0.004 | 0.304 | 5.06 | 0.004 | 0.293 | -0.318 | 0.004 |
200 | 0.300 | 1.01 | 0.002 | 0.301 | 1.35 | 0.002 | 0.296 | -1.473 | 0.002 |
ggplot(sdat, aes(y=estMean))+
geom_boxplot()+
labs(y="Average Latent Variable ICC")+
facet_grid(N1~Estimator)
ggplot(sdat, aes(y=RB))+
geom_boxplot()+
geom_hline(yintercept=-10, color="red", linetype="dashed")+
geom_hline(yintercept=10, color="red", linetype="dashed")+
labs(y="Relative Bias")+
facet_grid(N1~Estimator)
ggplot(sdat, aes(y=RMSE))+
geom_boxplot()+
labs(y="Root Mean Square Error")+
facet_grid(N1~Estimator)
c <- sdat %>%
group_by(Estimator, N1) %>%
summarise(est = mean(estMean),
RB = mean(RB),
RMSE = mean(RMSE),
Bias = mean(Bias),
SampVar =mean(SampVar))
c1 <- cbind(c[ c$Estimator == 'MLR', c( 'N1', 'est', 'RB', 'RMSE')],
c[ c$Estimator == 'ULSMV', c('est', 'RB', 'RMSE')],
c[ c$Estimator == 'WLSMV', c('est', 'RB', 'RMSE')])
colnames(c1) <- c('N1', rep(c('est', 'RB', 'RMSE'), 3))
kable(c1, format='html', digits=3, row.names = F) %>%
kable_styling(full_width = T) %>%
add_header_above(c(' '=1, 'MLR'=3, 'ULSMV'=3, 'WLSMV'=3))
N1 | est | RB | RMSE | est | RB | RMSE | est | RB | RMSE |
---|---|---|---|---|---|---|---|---|---|
5 | 0.307 | 13.40 | 0.009 | 0.313 | 14.66 | 0.010 | 0.285 | 1.24 | 0.009 |
10 | 0.302 | 7.00 | 0.006 | 0.307 | 8.18 | 0.006 | 0.285 | -1.88 | 0.006 |
30 | 0.300 | 4.25 | 0.004 | 0.304 | 5.60 | 0.004 | 0.290 | -1.11 | 0.005 |
ggplot(sdat, aes(y=estMean,x=N1, group=N1))+
geom_boxplot()+
labs(y="Average Latent Variable ICC")+
facet_grid(N2~Estimator)
ggplot(sdat, aes(y=RB,x=N1, group=N1))+
geom_boxplot()+
geom_hline(yintercept=-10, color="red", linetype="dashed")+
geom_hline(yintercept=10, color="red", linetype="dashed")+
labs(y="Relative Bias")+
facet_grid(N2~Estimator)
ggplot(sdat, aes(y=RMSE,x=N1, group=N1))+
geom_boxplot()+
labs(y="Root Mean Square Error")+
facet_grid(N2~Estimator)
c <- sdat %>%
group_by(Estimator, N2, N1) %>%
summarise(est = mean(estMean),
RB = mean(RB),
RMSE = mean(RMSE),
Bias = mean(Bias),
SampVar =mean(SampVar))
c1 <- cbind(c[ c$Estimator == 'MLR', c( 'N2','N1', 'est', 'RB', 'RMSE')],
c[ c$Estimator == 'ULSMV', c('est', 'RB', 'RMSE')],
c[ c$Estimator == 'WLSMV', c('est', 'RB', 'RMSE')])
colnames(c1) <- c('N2','N1', rep(c('est', 'RB', 'RMSE'), 3))
kable(c1, format='html', digits=3, row.names = F) %>%
kable_styling(full_width = T) %>%
add_header_above(c(' '=2, 'MLR'=3, 'ULSMV'=3, 'WLSMV'=3))
N2 | N1 | est | RB | RMSE | est | RB | RMSE | est | RB | RMSE |
---|---|---|---|---|---|---|---|---|---|---|
30 | 5 | 0.316 | 25.561 | 0.017 | 0.333 | 32.294 | 0.019 | 0.270 | 1.960 | 0.018 |
30 | 10 | 0.304 | 14.287 | 0.012 | 0.313 | 17.037 | 0.012 | 0.268 | -3.237 | 0.013 |
30 | 30 | 0.302 | 9.572 | 0.008 | 0.309 | 12.335 | 0.008 | 0.281 | -1.055 | 0.009 |
50 | 5 | 0.308 | 16.322 | 0.011 | 0.309 | 15.309 | 0.011 | 0.279 | 2.414 | 0.011 |
50 | 10 | 0.304 | 9.775 | 0.007 | 0.309 | 10.590 | 0.007 | 0.284 | -1.072 | 0.007 |
50 | 30 | 0.301 | 5.621 | 0.005 | 0.305 | 6.960 | 0.005 | 0.289 | -0.653 | 0.005 |
100 | 5 | 0.305 | 8.737 | 0.005 | 0.307 | 8.220 | 0.005 | 0.293 | 1.102 | 0.005 |
100 | 10 | 0.301 | 3.215 | 0.003 | 0.303 | 3.799 | 0.003 | 0.292 | -1.678 | 0.003 |
100 | 30 | 0.300 | 2.507 | 0.003 | 0.302 | 3.169 | 0.003 | 0.295 | -0.379 | 0.003 |
200 | 5 | 0.302 | 2.962 | 0.003 | 0.303 | 2.818 | 0.003 | 0.296 | -0.534 | 0.003 |
200 | 10 | 0.299 | 0.744 | 0.002 | 0.301 | 1.290 | 0.002 | 0.296 | -1.533 | 0.002 |
200 | 30 | 0.298 | -0.685 | 0.001 | 0.300 | -0.052 | 0.001 | 0.295 | -2.352 | 0.001 |
sdat <- filter(result, Variable %like% 'icc_lv')
c <- sdat %>%
group_by(Estimator, N2, N1) %>%
summarise(mu = weighted.mean(muRE, wi),
mw = weighted.mean(mwRE, wi),
uw = weighted.mean(uwRE, wi))
c1 <- cbind(c[ c$Estimator == 'MLR', c( 'N2','N1', 'mu', 'mw', 'uw')])
colnames(c1) <- c('N2','N1',c('MLR/ULSMV', 'MLR/WLSMV', 'ULSMV/WLSMV'))
kable(c1, format='html', digits=3, row.names = F) %>%
kable_styling(full_width = T)
N2 | N1 | MLR/ULSMV | MLR/WLSMV | ULSMV/WLSMV |
---|---|---|---|---|
30 | 5 | 1.982 | 1.865 | 1.054 |
30 | 10 | 1.199 | 1.211 | 1.026 |
30 | 30 | 1.077 | 1.122 | 1.036 |
50 | 5 | 1.337 | 1.449 | 1.080 |
50 | 10 | 1.088 | 1.126 | 1.030 |
50 | 30 | 1.020 | 1.022 | 1.003 |
100 | 5 | 1.119 | 1.134 | 1.016 |
100 | 10 | 1.030 | 1.058 | 1.025 |
100 | 30 | 1.003 | 0.998 | 0.996 |
200 | 5 | 1.033 | 1.052 | 1.017 |
200 | 10 | 1.004 | 1.015 | 1.011 |
200 | 30 | 0.999 | 0.992 | 0.993 |
c <- sdat %>%
group_by(Estimator, N2, N1, ICC_OV, ICC_LV) %>%
summarise(mu = weighted.mean(muRE, wi),
mw = weighted.mean(mwRE, wi),
uw = weighted.mean(uwRE, wi))
c1 <- cbind(c[ c$Estimator == 'MLR', c( 'N2','N1','ICC_OV', 'ICC_LV', 'mu', 'mw', 'uw')])
colnames(c1) <- c('N2','N1', 'ICC_OV', 'ICC_LV',c('MLR/ULSMV', 'MLR/WLSMV', 'ULSMV/WLSMV'))
kable(c1, format='html', digits=3, row.names = F) %>%
kable_styling(full_width = T)
N2 | N1 | ICC_OV | ICC_LV | MLR/ULSMV | MLR/WLSMV | ULSMV/WLSMV |
---|---|---|---|---|---|---|
30 | 5 | 0.1 | 0.1 | 5.621 | 4.385 | 0.784 |
30 | 5 | 0.1 | 0.5 | 3.549 | 3.452 | 0.973 |
30 | 5 | 0.3 | 0.1 | 1.142 | 1.661 | 1.454 |
30 | 5 | 0.3 | 0.5 | 1.017 | 0.846 | 0.833 |
30 | 5 | 0.5 | 0.1 | 0.846 | 1.735 | 2.054 |
30 | 5 | 0.5 | 0.5 | 1.005 | 0.844 | 0.839 |
30 | 10 | 0.1 | 0.1 | 1.488 | 1.377 | 0.926 |
30 | 10 | 0.1 | 0.5 | 1.925 | 1.944 | 1.008 |
30 | 10 | 0.3 | 0.1 | 1.005 | 1.407 | 1.401 |
30 | 10 | 0.3 | 0.5 | 1.037 | 0.897 | 0.865 |
30 | 10 | 0.5 | 0.1 | 0.903 | 1.403 | 1.554 |
30 | 10 | 0.5 | 0.5 | 1.068 | 0.853 | 0.798 |
30 | 30 | 0.1 | 0.1 | 1.058 | 1.007 | 0.951 |
30 | 30 | 0.1 | 0.5 | 1.324 | 1.651 | 1.247 |
30 | 30 | 0.3 | 0.1 | 1.012 | 1.213 | 1.199 |
30 | 30 | 0.3 | 0.5 | 1.022 | 0.897 | 0.878 |
30 | 30 | 0.5 | 0.1 | 0.873 | 1.116 | 1.280 |
30 | 30 | 0.5 | 0.5 | 1.057 | 0.899 | 0.851 |
50 | 5 | 0.1 | 0.1 | 2.361 | 2.323 | 0.984 |
50 | 5 | 0.1 | 0.5 | 2.235 | 2.803 | 1.253 |
50 | 5 | 0.3 | 0.1 | 1.017 | 1.375 | 1.352 |
50 | 5 | 0.3 | 0.5 | 1.003 | 0.914 | 0.912 |
50 | 5 | 0.5 | 0.1 | 0.939 | 1.404 | 1.495 |
50 | 5 | 0.5 | 0.5 | 1.007 | 0.864 | 0.858 |
50 | 10 | 0.1 | 0.1 | 1.139 | 1.070 | 0.940 |
50 | 10 | 0.1 | 0.5 | 1.364 | 1.669 | 1.225 |
50 | 10 | 0.3 | 0.1 | 1.025 | 1.190 | 1.162 |
50 | 10 | 0.3 | 0.5 | 1.018 | 0.921 | 0.905 |
50 | 10 | 0.5 | 0.1 | 0.923 | 1.234 | 1.338 |
50 | 10 | 0.5 | 0.5 | 1.028 | 0.867 | 0.844 |
50 | 30 | 0.1 | 0.1 | 1.010 | 0.960 | 0.950 |
50 | 30 | 0.1 | 0.5 | 1.077 | 1.241 | 1.152 |
50 | 30 | 0.3 | 0.1 | 0.984 | 1.051 | 1.068 |
50 | 30 | 0.3 | 0.5 | 1.020 | 0.914 | 0.897 |
50 | 30 | 0.5 | 0.1 | 0.929 | 1.083 | 1.166 |
50 | 30 | 0.5 | 0.5 | 1.060 | 0.913 | 0.861 |
100 | 5 | 0.1 | 0.1 | 1.314 | 1.207 | 0.919 |
100 | 5 | 0.1 | 0.5 | 1.481 | 1.553 | 1.049 |
100 | 5 | 0.3 | 0.1 | 0.989 | 1.127 | 1.139 |
100 | 5 | 0.3 | 0.5 | 1.011 | 0.944 | 0.933 |
100 | 5 | 0.5 | 0.1 | 0.959 | 1.158 | 1.208 |
100 | 5 | 0.5 | 0.5 | 1.013 | 0.953 | 0.940 |
100 | 10 | 0.1 | 0.1 | 1.024 | 1.002 | 0.978 |
100 | 10 | 0.1 | 0.5 | 1.126 | 1.308 | 1.161 |
100 | 10 | 0.3 | 0.1 | 1.012 | 1.068 | 1.056 |
100 | 10 | 0.3 | 0.5 | 1.003 | 0.960 | 0.957 |
100 | 10 | 0.5 | 0.1 | 0.973 | 1.088 | 1.118 |
100 | 10 | 0.5 | 0.5 | 1.023 | 0.935 | 0.914 |
100 | 30 | 0.1 | 0.1 | 1.004 | 0.979 | 0.974 |
100 | 30 | 0.1 | 0.5 | 1.018 | 1.074 | 1.055 |
100 | 30 | 0.3 | 0.1 | 1.002 | 1.014 | 1.012 |
100 | 30 | 0.3 | 0.5 | 0.997 | 0.960 | 0.962 |
100 | 30 | 0.5 | 0.1 | 0.946 | 1.038 | 1.097 |
100 | 30 | 0.5 | 0.5 | 1.034 | 0.936 | 0.905 |
200 | 5 | 0.1 | 0.1 | 1.044 | 1.029 | 0.986 |
200 | 5 | 0.1 | 0.5 | 1.141 | 1.236 | 1.083 |
200 | 5 | 0.3 | 0.1 | 1.016 | 1.037 | 1.020 |
200 | 5 | 0.3 | 0.5 | 0.998 | 0.978 | 0.979 |
200 | 5 | 0.5 | 0.1 | 0.979 | 1.059 | 1.082 |
200 | 5 | 0.5 | 0.5 | 1.008 | 0.978 | 0.970 |
200 | 10 | 0.1 | 0.1 | 1.008 | 0.994 | 0.986 |
200 | 10 | 0.1 | 0.5 | 1.016 | 1.096 | 1.079 |
200 | 10 | 0.3 | 0.1 | 0.997 | 1.007 | 1.010 |
200 | 10 | 0.3 | 0.5 | 1.004 | 0.988 | 0.984 |
200 | 10 | 0.5 | 0.1 | 0.980 | 1.037 | 1.059 |
200 | 10 | 0.5 | 0.5 | 1.012 | 0.970 | 0.958 |
200 | 30 | 0.1 | 0.1 | 1.003 | 1.000 | 0.996 |
200 | 30 | 0.1 | 0.5 | 1.006 | 1.005 | 0.999 |
200 | 30 | 0.3 | 0.1 | 0.988 | 1.000 | 1.012 |
200 | 30 | 0.3 | 0.5 | 0.999 | 0.974 | 0.975 |
200 | 30 | 0.5 | 0.1 | 0.991 | 1.012 | 1.022 |
200 | 30 | 0.5 | 0.5 | 1.007 | 0.965 | 0.958 |
c <- sdat %>%
group_by(Estimator, N2, N1) %>%
summarise(est = weighted.mean(estMean, wi),
RB = weighted.mean(RB, wi),
RMSE = weighted.mean(RMSE, wi))
c1 <- cbind(c[ c$Estimator == 'MLR', c( 'N2','N1', 'est', 'RB', 'RMSE')],
c[ c$Estimator == 'ULSMV', c('est', 'RB', 'RMSE')],
c[ c$Estimator == 'WLSMV', c('est', 'RB', 'RMSE')])
colnames(c1) <- c('N2','N1', rep(c('est', 'RB', 'RMSE'), 3))
kable(c1, format='html', digits=3, row.names = F) %>%
kable_styling(full_width = T) %>%
add_header_above(c(' '=2, 'MLR'=3, 'ULSMV'=3, 'WLSMV'=3))
N2 | N1 | est | RB | RMSE | est | RB | RMSE | est | RB | RMSE |
---|---|---|---|---|---|---|---|---|---|---|
30 | 5 | 0.348 | 16.522 | 0.017 | 0.406 | 26.150 | 0.022 | 0.344 | -4.953 | 0.025 |
30 | 10 | 0.336 | 8.725 | 0.012 | 0.351 | 14.435 | 0.013 | 0.309 | -5.982 | 0.015 |
30 | 30 | 0.328 | 4.342 | 0.008 | 0.323 | 7.871 | 0.008 | 0.287 | -4.978 | 0.009 |
50 | 5 | 0.344 | 11.310 | 0.011 | 0.365 | 15.943 | 0.012 | 0.342 | 0.381 | 0.014 |
50 | 10 | 0.330 | 5.927 | 0.007 | 0.330 | 7.873 | 0.007 | 0.301 | -3.748 | 0.008 |
50 | 30 | 0.319 | 3.155 | 0.005 | 0.318 | 4.464 | 0.005 | 0.294 | -2.975 | 0.005 |
100 | 5 | 0.328 | 6.820 | 0.005 | 0.329 | 7.804 | 0.006 | 0.314 | 0.356 | 0.005 |
100 | 10 | 0.316 | 2.147 | 0.003 | 0.312 | 2.818 | 0.003 | 0.294 | -2.575 | 0.003 |
100 | 30 | 0.310 | 1.549 | 0.002 | 0.311 | 2.268 | 0.002 | 0.299 | -1.430 | 0.003 |
200 | 5 | 0.314 | 2.398 | 0.003 | 0.310 | 2.458 | 0.003 | 0.301 | -0.893 | 0.003 |
200 | 10 | 0.307 | 0.496 | 0.002 | 0.308 | 0.993 | 0.002 | 0.299 | -1.748 | 0.002 |
200 | 30 | 0.303 | -0.736 | 0.001 | 0.305 | -0.149 | 0.001 | 0.300 | -2.364 | 0.001 |
print(xtable(c1, digits = 3,align=c("l", "l", "l", rep("r",9)),
display=c("s", "d","d", rep("f",9)),
caption="Mean Latent Variable ICC, Relative Bias, and RMSE by Estimation Method",
label="tb:fct"),
booktabs = T, include.rownames = F,
caption.placement = "top")
% latex table generated in R 3.6.3 by xtable 1.8-4 package
% Mon Jun 01 23:24:57 2020
\begin{table}[ht]
\centering
\caption{Mean Latent Variable ICC, Relative Bias, and RMSE by Estimation Method}
\label{tb:fct}
\begin{tabular}{llrrrrrrrrr}
\toprule
N2 & N1 & est & RB & RMSE & est & RB & RMSE & est & RB & RMSE \\
\midrule
30 & 5 & 0.348 & 16.522 & 0.017 & 0.406 & 26.150 & 0.022 & 0.344 & -4.953 & 0.025 \\
30 & 10 & 0.336 & 8.725 & 0.012 & 0.351 & 14.435 & 0.013 & 0.309 & -5.982 & 0.015 \\
30 & 30 & 0.328 & 4.342 & 0.008 & 0.323 & 7.871 & 0.008 & 0.287 & -4.978 & 0.009 \\
50 & 5 & 0.344 & 11.310 & 0.011 & 0.365 & 15.943 & 0.012 & 0.342 & 0.381 & 0.014 \\
50 & 10 & 0.330 & 5.927 & 0.007 & 0.330 & 7.873 & 0.007 & 0.301 & -3.748 & 0.008 \\
50 & 30 & 0.319 & 3.155 & 0.005 & 0.318 & 4.464 & 0.005 & 0.294 & -2.975 & 0.005 \\
100 & 5 & 0.328 & 6.820 & 0.005 & 0.329 & 7.804 & 0.006 & 0.314 & 0.356 & 0.005 \\
100 & 10 & 0.316 & 2.147 & 0.003 & 0.312 & 2.818 & 0.003 & 0.294 & -2.575 & 0.003 \\
100 & 30 & 0.310 & 1.549 & 0.002 & 0.311 & 2.268 & 0.002 & 0.299 & -1.430 & 0.003 \\
200 & 5 & 0.314 & 2.398 & 0.003 & 0.310 & 2.458 & 0.003 & 0.301 & -0.893 & 0.003 \\
200 & 10 & 0.307 & 0.496 & 0.002 & 0.308 & 0.993 & 0.002 & 0.299 & -1.748 & 0.002 \\
200 & 30 & 0.303 & -0.736 & 0.001 & 0.305 & -0.149 & 0.001 & 0.300 & -2.364 & 0.001 \\
\bottomrule
\end{tabular}
\end{table}
sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] xtable_1.8-4 kableExtra_1.1.0 cowplot_1.0.0
[4] MplusAutomation_0.7-3 data.table_1.12.8 patchwork_1.0.0
[7] forcats_0.5.0 stringr_1.4.0 dplyr_0.8.5
[10] purrr_0.3.4 readr_1.3.1 tidyr_1.1.0
[13] tibble_3.0.1 ggplot2_3.3.0 tidyverse_1.3.0
[16] workflowr_1.6.2
loaded via a namespace (and not attached):
[1] httr_1.4.1 jsonlite_1.6.1 viridisLite_0.3.0 gsubfn_0.7
[5] modelr_0.1.8 assertthat_0.2.1 highr_0.8 pander_0.6.3
[9] blob_1.2.1 cellranger_1.1.0 yaml_2.2.1 pillar_1.4.4
[13] backports_1.1.7 lattice_0.20-38 glue_1.4.1 digest_0.6.25
[17] promises_1.1.0 rvest_0.3.5 colorspace_1.4-1 htmltools_0.4.0
[21] httpuv_1.5.2 plyr_1.8.6 pkgconfig_2.0.3 broom_0.5.6
[25] haven_2.3.0 scales_1.1.1 webshot_0.5.2 later_1.0.0
[29] git2r_0.27.1 farver_2.0.3 generics_0.0.2 ellipsis_0.3.1
[33] withr_2.2.0 cli_2.0.2 proto_1.0.0 magrittr_1.5
[37] crayon_1.3.4 readxl_1.3.1 evaluate_0.14 fs_1.4.1
[41] fansi_0.4.1 nlme_3.1-144 xml2_1.3.2 tools_3.6.3
[45] hms_0.5.3 lifecycle_0.2.0 munsell_0.5.0 reprex_0.3.0
[49] compiler_3.6.3 rlang_0.4.6 grid_3.6.3 rstudioapi_0.11
[53] texreg_1.36.23 labeling_0.3 rmarkdown_2.1 boot_1.3-24
[57] gtable_0.3.0 DBI_1.1.0 R6_2.4.1 lubridate_1.7.8
[61] knitr_1.28 rprojroot_1.3-2 stringi_1.4.6 parallel_3.6.3
[65] Rcpp_1.0.4.6 vctrs_0.3.0 dbplyr_1.4.4 tidyselect_1.1.0
[69] xfun_0.14 coda_0.19-3