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)

Summarizing Results

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).

*Click here for more details

Observed Variable ICC

sdat <- filter(result, Variable %like% 'icc_ov')

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 Observed Variable ICC")

p2 <- ggplot(sdat, aes(y=estSD))+
  geom_boxplot()+
  labs(y="SD of Observed 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 OBSERVED VARIABLE ICC")
p

Single Condition Breakdown

Estimation Method

ggplot(sdat, aes(y=estMean))+
  geom_boxplot()+
  labs(y="Average Observed Variable ICC",
       title="OBSERVED VARIABLE ICC by Estimation Method",
       subtitle="Parameter Estimates")+
  facet_wrap(.~Estimator)

ggplot(sdat, aes(y=estSD))+
  geom_boxplot()+
  labs(y="SD of Observed Variable ICC",
       title="OBSERVED 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="OBSERVED 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="OBSERVED 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="OBSERVED 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="OBSERVED 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 OBSERVED VARIABLE ICC by Estimation Method") %>%
  kable_styling(full_width = T)
Summary Indices of OBSERVED VARIABLE ICC by Estimation Method
Estimator est RB RMSE Bias SampVar
MLR 0.257 -14.97 0.005 0.002 0.003
ULSMV 0.292 -1.86 0.005 0.000 0.004
WLSMV 0.299 1.66 0.005 0.000 0.005

Level-2 Sample Size

ggplot(sdat, aes(y=estMean))+
  geom_boxplot()+
  labs(y="Average Observed Variable ICC",
       title="OBSERVED VARIABLE ICC by Level-2 Sample Size",
       subtitle="Parameter Estimates")+
  facet_wrap(.~N2)

ggplot(sdat, aes(y=estSD))+
  geom_boxplot()+
  labs(y="SD of Observed Variable ICC",
       title="OBSERVED 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="OBSERVED 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="OBSERVED 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="OBSERVED 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="OBSERVED 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 OBSERVED VARIABLE ICC by Level-2 Sample Size") %>%
  kable_styling(full_width = T)
Summary Indices of OBSERVED VARIABLE ICC by Level-2 Sample Size
N2 est RB RMSE Bias SampVar
30 0.278 -5.34 0.009 0.001 0.008
50 0.282 -5.09 0.006 0.001 0.005
100 0.285 -5.04 0.003 0.001 0.002
200 0.286 -4.76 0.002 0.001 0.001

Level-1 Sample Size

ggplot(sdat, aes(y=estMean))+
  geom_boxplot()+
  labs(y="Average Observed Variable ICC",
       title="OBSERVED VARIABLE ICC by Level-1",
       subtitle="Parameter Estimates")+
  facet_wrap(.~N1)

ggplot(sdat, aes(y=estSD))+
  geom_boxplot()+
  labs(y="SD of Observed Variable ICC",
       title="OBSERVED 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="OBSERVED 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="OBSERVED 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="OBSERVED 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="OBSERVED 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 OBSERVED VARIABLE ICC  by Level-1 Sample Size") %>%
  kable_styling(full_width = T)
Summary Indices of OBSERVED VARIABLE ICC by Level-1 Sample Size
N1 est RB RMSE Bias SampVar
5 0.284 -3.33 0.007 0.001 0.006
10 0.282 -5.72 0.004 0.001 0.004
30 0.282 -6.12 0.003 0.001 0.002

ICC Observed Variables

ggplot(sdat, aes(y=estMean))+
  geom_boxplot()+
  labs(y="Average Observed Variable ICC",
       title="OBSERVED 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 Observed Variable ICC",
       title="OBSERVED 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="OBSERVED 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="OBSERVED 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="OBSERVED 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="OBSERVED 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 OBSERVED VARIABLE ICC by ICC of Observed Variables") %>%
  kable_styling(full_width = T)
Summary Indices of OBSERVED VARIABLE ICC by ICC of Observed Variables
ICC_OV est RB RMSE Bias SampVar
0.1 0.097 -2.88 0.003 0.000 0.002
0.3 0.281 -6.29 0.005 0.001 0.005
0.5 0.470 -6.00 0.007 0.002 0.005

ICC Latent Variables

ggplot(sdat, aes(y=estMean))+
  geom_boxplot()+
  labs(y="Average Observed Variable ICC",
       title="OBSERVED 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 Observed Variable ICC",
       title="OBSERVED 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="OBSERVED 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="OBSERVED 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="OBSERVED 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="OBSERVED 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 OBSERVED VARIABLE ICC by ICC of Latent Variables") %>%
  kable_styling(full_width = T)
Summary Indices of OBSERVED VARIABLE ICC by ICC of Latent Variables
ICC_LV est RB RMSE Bias SampVar
0.1 0.283 -5.06 0.004 0.001 0.003
0.5 0.283 -5.05 0.006 0.001 0.005

By Estimation Method and Sample Sizes

Estimation Method & Level-2 Sample Size

ggplot(sdat, aes(y=estMean))+
  geom_boxplot()+
  labs(y="Average Observed 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))
MLR
ULSMV
WLSMV
N2 est RB RMSE est RB RMSE est RB RMSE
30 0.249 -17.4 0.009 0.285 -2.86 0.009 0.300 4.220 0.009
50 0.256 -15.3 0.006 0.291 -2.06 0.005 0.299 2.131 0.006
100 0.260 -13.9 0.004 0.295 -1.53 0.003 0.299 0.373 0.003
200 0.262 -13.2 0.003 0.297 -1.00 0.001 0.299 -0.079 0.001

Estimation Method & Level-1 Sample Size

ggplot(sdat, aes(y=estMean))+
  geom_boxplot()+
  labs(y="Average Observed 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))
MLR
ULSMV
WLSMV
N1 est RB RMSE est RB RMSE est RB RMSE
5 0.256 -15.3 0.007 0.293 0.171 0.007 0.304 5.193 0.007
10 0.257 -14.9 0.005 0.291 -2.716 0.004 0.298 0.473 0.004
30 0.258 -14.6 0.004 0.291 -3.045 0.003 0.296 -0.682 0.003

Estimation Method, Level-2 Sample Size & Level-1 Sample Size

ggplot(sdat, aes(y=estMean,x=N1, group=N1))+
  geom_boxplot()+
  labs(y="Average Observed 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))
MLR
ULSMV
WLSMV
N2 N1 est RB RMSE est RB RMSE est RB RMSE
30 5 0.247 -18.1 0.012 0.289 1.849 0.013 0.311 12.488 0.013
30 10 0.250 -17.1 0.009 0.283 -4.503 0.008 0.297 1.309 0.008
30 30 0.251 -17.0 0.007 0.283 -5.919 0.006 0.292 -1.136 0.006
50 5 0.255 -15.5 0.008 0.293 0.799 0.008 0.304 6.530 0.008
50 10 0.256 -15.5 0.006 0.290 -3.344 0.005 0.299 0.817 0.005
50 30 0.257 -15.0 0.005 0.290 -3.619 0.003 0.295 -0.953 0.003
100 5 0.259 -14.1 0.005 0.295 -0.765 0.004 0.300 1.683 0.004
100 10 0.260 -14.1 0.004 0.295 -2.035 0.002 0.299 -0.126 0.003
100 30 0.260 -13.6 0.003 0.295 -1.806 0.002 0.298 -0.439 0.002
200 5 0.262 -13.6 0.003 0.297 -1.198 0.002 0.300 0.070 0.002
200 10 0.262 -13.1 0.003 0.297 -0.982 0.001 0.299 -0.106 0.001
200 30 0.263 -12.9 0.002 0.298 -0.835 0.001 0.299 -0.200 0.001

Relative Efficiency by Sample Sizes

sdat <- filter(result, Variable %like% 'icc_ov')

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.66 1.58 1.047
30 10 1.15 1.26 1.088
30 30 1.05 1.14 1.078
50 5 1.26 1.36 1.076
50 10 1.09 1.13 1.030
50 30 1.09 1.09 1.001
100 5 1.16 1.17 1.010
100 10 1.15 1.16 1.008
100 30 1.23 1.20 0.965
200 5 1.21 1.21 0.994
200 10 1.33 1.31 0.971
200 30 1.53 1.47 0.941

Relative Efficiency by All Conditions

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 3.812 2.657 0.712
30 5 0.1 0.5 2.928 2.841 0.969
30 5 0.3 0.1 1.131 1.393 1.233
30 5 0.3 0.5 0.960 0.972 1.011
30 5 0.5 0.1 1.115 1.448 1.300
30 5 0.5 0.5 1.034 1.140 1.103
30 10 0.1 0.1 1.180 1.128 0.956
30 10 0.1 0.5 1.688 1.991 1.172
30 10 0.3 0.1 1.009 1.236 1.226
30 10 0.3 0.5 0.974 0.972 0.997
30 10 0.5 0.1 1.161 1.421 1.223
30 10 0.5 0.5 1.111 1.193 1.074
30 30 0.1 0.1 0.923 0.939 1.017
30 30 0.1 0.5 1.029 1.355 1.315
30 30 0.3 0.1 1.089 1.191 1.094
30 30 0.3 0.5 1.003 0.929 0.927
30 30 0.5 0.1 1.220 1.383 1.135
30 30 0.5 0.5 1.158 1.187 1.025
50 5 0.1 0.1 1.744 1.663 0.957
50 5 0.1 0.5 2.024 2.370 1.172
50 5 0.3 0.1 0.979 1.183 1.208
50 5 0.3 0.5 0.957 0.942 0.985
50 5 0.5 0.1 1.163 1.427 1.228
50 5 0.5 0.5 1.101 1.143 1.039
50 10 0.1 0.1 1.002 0.941 0.938
50 10 0.1 0.5 1.118 1.259 1.124
50 10 0.3 0.1 1.072 1.161 1.084
50 10 0.3 0.5 0.982 0.914 0.931
50 10 0.5 0.1 1.237 1.419 1.148
50 10 0.5 0.5 1.201 1.247 1.038
50 30 0.1 0.1 0.925 0.931 1.006
50 30 0.1 0.5 0.829 0.833 1.003
50 30 0.3 0.1 1.159 1.210 1.044
50 30 0.3 0.5 1.068 0.955 0.894
50 30 0.5 0.1 1.381 1.477 1.070
50 30 0.5 0.5 1.289 1.317 1.022
100 5 0.1 0.1 1.094 1.003 0.917
100 5 0.1 0.5 1.223 1.292 1.055
100 5 0.3 0.1 1.069 1.155 1.081
100 5 0.3 0.5 0.993 0.928 0.934
100 5 0.5 0.1 1.337 1.469 1.099
100 5 0.5 0.5 1.273 1.297 1.019
100 10 0.1 0.1 0.909 0.906 0.997
100 10 0.1 0.5 0.876 0.924 1.054
100 10 0.3 0.1 1.186 1.231 1.038
100 10 0.3 0.5 1.102 0.999 0.907
100 10 0.5 0.1 1.522 1.597 1.050
100 10 0.5 0.5 1.432 1.461 1.020
100 30 0.1 0.1 0.991 0.994 1.003
100 30 0.1 0.5 0.787 0.665 0.844
100 30 0.3 0.1 1.316 1.336 1.016
100 30 0.3 0.5 1.217 1.075 0.883
100 30 0.5 0.1 1.657 1.755 1.059
100 30 0.5 0.5 1.540 1.560 1.013
200 5 0.1 0.1 0.901 0.897 0.995
200 5 0.1 0.5 0.907 0.893 0.984
200 5 0.3 0.1 1.205 1.227 1.018
200 5 0.3 0.5 1.131 1.045 0.924
200 5 0.5 0.1 1.617 1.702 1.052
200 5 0.5 0.5 1.570 1.578 1.005
200 10 0.1 0.1 0.927 0.928 1.001
200 10 0.1 0.5 0.783 0.701 0.894
200 10 0.3 0.1 1.401 1.414 1.009
200 10 0.3 0.5 1.298 1.168 0.899
200 10 0.5 0.1 1.912 1.970 1.030
200 10 0.5 0.5 1.796 1.810 1.007
200 30 0.1 0.1 1.112 1.115 1.003
200 30 0.1 0.5 0.922 0.690 0.748
200 30 0.3 0.1 1.597 1.612 1.009
200 30 0.3 0.5 1.486 1.304 0.877
200 30 0.5 0.1 2.150 2.173 1.011
200 30 0.5 0.5 2.001 2.015 1.007

Manuscript Table

c <- sdat %>%
  group_by(Estimator, N2, N1) %>%
  summarise(est = mean(estMean),
            RB = mean(RB),
            RMSE = mean(RMSE))

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))
MLR
ULSMV
WLSMV
N2 N1 est RB RMSE est RB RMSE est RB RMSE
30 5 0.247 -18.1 0.012 0.289 1.849 0.013 0.311 12.488 0.013
30 10 0.250 -17.1 0.009 0.283 -4.503 0.008 0.297 1.309 0.008
30 30 0.251 -17.0 0.007 0.283 -5.919 0.006 0.292 -1.136 0.006
50 5 0.255 -15.5 0.008 0.293 0.799 0.008 0.304 6.530 0.008
50 10 0.256 -15.5 0.006 0.290 -3.344 0.005 0.299 0.817 0.005
50 30 0.257 -15.0 0.005 0.290 -3.619 0.003 0.295 -0.953 0.003
100 5 0.259 -14.1 0.005 0.295 -0.765 0.004 0.300 1.683 0.004
100 10 0.260 -14.1 0.004 0.295 -2.035 0.002 0.299 -0.126 0.003
100 30 0.260 -13.6 0.003 0.295 -1.806 0.002 0.298 -0.439 0.002
200 5 0.262 -13.6 0.003 0.297 -1.198 0.002 0.300 0.070 0.002
200 10 0.262 -13.1 0.003 0.297 -0.982 0.001 0.299 -0.106 0.001
200 30 0.263 -12.9 0.002 0.298 -0.835 0.001 0.299 -0.200 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 Observed 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:25:58 2020
\begin{table}[ht]
\centering
\caption{Mean Observed 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.247 & -18.079 & 0.012 & 0.289 & 1.849 & 0.013 & 0.311 & 12.488 & 0.013 \\ 
  30 & 10 & 0.250 & -17.093 & 0.009 & 0.283 & -4.503 & 0.008 & 0.297 & 1.309 & 0.008 \\ 
  30 & 30 & 0.251 & -16.974 & 0.007 & 0.283 & -5.919 & 0.006 & 0.292 & -1.136 & 0.006 \\ 
  50 & 5 & 0.255 & -15.546 & 0.008 & 0.293 & 0.799 & 0.008 & 0.304 & 6.530 & 0.008 \\ 
  50 & 10 & 0.256 & -15.461 & 0.006 & 0.290 & -3.344 & 0.005 & 0.299 & 0.817 & 0.005 \\ 
  50 & 30 & 0.257 & -15.006 & 0.005 & 0.290 & -3.619 & 0.003 & 0.295 & -0.953 & 0.003 \\ 
  100 & 5 & 0.259 & -14.130 & 0.005 & 0.295 & -0.765 & 0.004 & 0.300 & 1.683 & 0.004 \\ 
  100 & 10 & 0.260 & -14.071 & 0.004 & 0.295 & -2.035 & 0.002 & 0.299 & -0.126 & 0.003 \\ 
  100 & 30 & 0.260 & -13.630 & 0.003 & 0.295 & -1.806 & 0.002 & 0.298 & -0.439 & 0.002 \\ 
  200 & 5 & 0.262 & -13.625 & 0.003 & 0.297 & -1.198 & 0.002 & 0.300 & 0.070 & 0.002 \\ 
  200 & 10 & 0.262 & -13.075 & 0.003 & 0.297 & -0.982 & 0.001 & 0.299 & -0.106 & 0.001 \\ 
  200 & 30 & 0.263 & -12.928 & 0.002 & 0.298 & -0.835 & 0.001 & 0.299 & -0.200 & 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