Last updated: 2020-03-30

Checks: 6 1

Knit directory: mcfa-para-est/

This reproducible R Markdown analysis was created with workflowr (version 1.5.0). 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 version displayed above was the version of the Git repository at the time these results were generated.

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:    manuscript/
    Ignored:    sera-presentation/

Untracked files:
    Untracked:  analysis/main_analysis.Rmd
    Untracked:  analysis/ml-cfa-convergence-summary.Rmd
    Untracked:  analysis/ml-cfa-parameter-bias-RB.Rmd
    Untracked:  analysis/ml-cfa-parameter-convergence.Rmd
    Untracked:  code/combine_files_extract_para.R
    Untracked:  code/get_data.R
    Untracked:  code/get_data.Rmd
    Untracked:  code/load_packages.R
    Untracked:  data/compiled_para_results.txt
    Untracked:  output/fact-cov-converge-largeN.pdf
    Untracked:  output/fact-cov-converge-medN.pdf
    Untracked:  output/fact-cov-converge-smallN.pdf
    Untracked:  output/loading-converge-largeN.pdf
    Untracked:  output/loading-converge-medN.pdf
    Untracked:  output/loading-converge-smallN.pdf

Unstaged changes:
    Modified:   .gitignore
    Modified:   README.md
    Modified:   analysis/_site.yml
    Modified:   analysis/about.Rmd
    Modified:   analysis/index.Rmd
    Modified:   mcfa-para-est.Rproj

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.1 (2019-07-05)
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      MplusAutomation_0.7-3
 [4] data.table_1.12.6     forcats_0.4.0         stringr_1.4.0        
 [7] dplyr_0.8.3           purrr_0.3.3           readr_1.3.1          
[10] tidyr_1.0.0           tibble_2.1.3          ggplot2_3.2.1        
[13] tidyverse_1.3.0      

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3        lubridate_1.7.4   lattice_0.20-38   assertthat_0.2.1 
 [5] zeallot_0.1.0     rprojroot_1.3-2   digest_0.6.23     R6_2.4.1         
 [9] cellranger_1.1.0  plyr_1.8.4        backports_1.1.5   reprex_0.3.0     
[13] evaluate_0.14     coda_0.19-3       httr_1.4.1        pillar_1.4.2     
[17] rlang_0.4.2       lazyeval_0.2.2    readxl_1.3.1      rstudioapi_0.10  
[21] texreg_1.36.23    rmarkdown_1.18    gsubfn_0.7        proto_1.0.0      
[25] webshot_0.5.2     pander_0.6.3      munsell_0.5.0     broom_0.5.2      
[29] compiler_3.6.1    httpuv_1.5.2      modelr_0.1.5      xfun_0.11        
[33] pkgconfig_2.0.3   htmltools_0.4.0   tidyselect_0.2.5  workflowr_1.5.0  
[37] viridisLite_0.3.0 crayon_1.3.4      dbplyr_1.4.2      withr_2.1.2      
[41] later_1.0.0       grid_3.6.1        nlme_3.1-140      jsonlite_1.6     
[45] gtable_0.3.0      lifecycle_0.1.0   DBI_1.0.0         git2r_0.26.1     
[49] magrittr_1.5      scales_1.1.0      cli_1.1.0         stringi_1.4.3    
[53] fs_1.3.1          promises_1.1.0    xml2_1.2.2        generics_0.0.2   
[57] vctrs_0.2.0       boot_1.3-22       tools_3.6.1       glue_1.3.1       
[61] hms_0.5.2         parallel_3.6.1    yaml_2.2.0        colorspace_1.4-1 
[65] rvest_0.3.5       knitr_1.26        haven_2.2.0      

Trace Plots

sim_results <- filter(sim_results, Converge==1 & Admissible==1)

Factor Covariance

# Small N
con_dat <- filter(sim_results, ss_l2==30, ss_l1==10,
                  icc_lv==0.1, icc_ov==0.3)

p <- ggplot(con_dat, aes(x=Replication, y=psiB12, 
                         group=Estimator, color=Estimator)) +
  geom_line() +
  labs(y='Level-2 Factor Covariance')+
  theme_bw()
p

ggsave("manuscript/fig/fact-cov-converge-smallN.pdf", plot=p, width=7, height=4, units="in")
# Medium N
con_dat <- filter(sim_results, ss_l2==100, ss_l1==10,
                  icc_lv==0.1, icc_ov==0.3)
p <- ggplot(con_dat, aes(x=Replication, y=psiB12, 
                         group=Estimator, color=Estimator)) +
  geom_line() +
  labs(y='Level-2 Factor Covariance')+
  theme_bw()
p

ggsave("manuscript/fig/fact-cov-converge-medN.pdf", plot=p, width=7, height=4, units="in")
## Large N
con_dat <- filter(sim_results, ss_l2==200, ss_l1==10,
                  icc_lv==0.1, icc_ov==0.3)
p <- ggplot(con_dat, aes(x=Replication, y=psiB12, 
                         group=Estimator, color=Estimator)) +
  geom_line() +
  labs(y='Level-2 Factor Covariance')+
  theme_bw()
p

ggsave("manuscript/fig/fact-cov-converge-largeN.pdf", plot=p, width=7, height=4, units="in")

Factor Covariance

# Small N
con_dat <- filter(sim_results, ss_l2==30, ss_l1==10,
                  icc_lv==0.1, icc_ov==0.3)

p <- ggplot(con_dat, aes(x=Replication, y=psiB1, 
                         group=Estimator, color=Estimator)) +
  geom_line() +
  geom_hline(yintercept = 0.11, linetype="dashed")+
  labs(y='Level-2 Factor Variance')+
  theme_bw()
p

ggsave("manuscript/fig/fact-var-converge-smallN.pdf", plot=p, width=7, height=4, units="in")
## Large N
con_dat <- filter(sim_results, ss_l2==200, ss_l1==10,
                  icc_lv==0.1, icc_ov==0.3)
p <- ggplot(con_dat, aes(x=Replication, y=psiB1, 
                         group=Estimator, color=Estimator)) +
  geom_line() +
  geom_hline(yintercept = 0.11, linetype="dashed")+
  labs(y='Level-2 Factor Variance')+
  theme_bw()
p

ggsave("manuscript/fig/fact-var-converge-largeN.pdf", plot=p, width=7, height=4, units="in")

Item 1 Loading

# Small N
con_dat <- filter(sim_results, ss_l2==30, ss_l1==10,
                  icc_lv==0.1, icc_ov==0.3)
p <- ggplot(con_dat, aes(x=Replication, y=lambda11, 
                         group=Estimator, color=Estimator)) +
  geom_line() +
  geom_hline(yintercept = 0.6, linetype="dashed")+
  labs(y='Factor Loading (Item 1)')+
  theme_bw()
p

ggsave("manuscript/fig/loading-converge-smallN.pdf", plot=p, width=7, height=4, units="in")
# Medium N
con_dat <- filter(sim_results, ss_l2==100, ss_l1==10,
                  icc_lv==0.1, icc_ov==0.3)
p <- ggplot(con_dat, aes(x=Replication, y=lambda11, 
                         group=Estimator, color=Estimator)) +
  geom_line() +
  geom_hline(yintercept = 0.6, linetype="dashed")+
  labs(y='Factor Loading (Item 1)')+
  theme_bw()
p

ggsave("manuscript/fig/loading-converge-medN.pdf", plot=p, width=7, height=4, units="in")

## Large N
con_dat <- filter(sim_results, ss_l2==200, ss_l1==10,
                  icc_lv==0.1, icc_ov==0.3)
p <- ggplot(con_dat, aes(x=Replication, y=lambda11, 
                         group=Estimator, color=Estimator)) +
  geom_line() +
  geom_hline(yintercept = 0.6, linetype="dashed")+
  labs(y='Factor Loading (Item 1)')+
  theme_bw()
p

ggsave("manuscript/fig/loading-converge-largeN.pdf", plot=p, width=7, height=4, units="in")

sessionInfo()
R version 3.6.1 (2019-07-05)
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      MplusAutomation_0.7-3
 [4] data.table_1.12.6     forcats_0.4.0         stringr_1.4.0        
 [7] dplyr_0.8.3           purrr_0.3.3           readr_1.3.1          
[10] tidyr_1.0.0           tibble_2.1.3          ggplot2_3.2.1        
[13] tidyverse_1.3.0      

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3        lubridate_1.7.4   lattice_0.20-38   assertthat_0.2.1 
 [5] zeallot_0.1.0     rprojroot_1.3-2   digest_0.6.23     R6_2.4.1         
 [9] cellranger_1.1.0  plyr_1.8.4        backports_1.1.5   reprex_0.3.0     
[13] evaluate_0.14     coda_0.19-3       httr_1.4.1        pillar_1.4.2     
[17] rlang_0.4.2       lazyeval_0.2.2    readxl_1.3.1      rstudioapi_0.10  
[21] texreg_1.36.23    rmarkdown_1.18    gsubfn_0.7        labeling_0.3     
[25] proto_1.0.0       webshot_0.5.2     pander_0.6.3      munsell_0.5.0    
[29] broom_0.5.2       compiler_3.6.1    httpuv_1.5.2      modelr_0.1.5     
[33] xfun_0.11         pkgconfig_2.0.3   htmltools_0.4.0   tidyselect_0.2.5 
[37] workflowr_1.5.0   viridisLite_0.3.0 crayon_1.3.4      dbplyr_1.4.2     
[41] withr_2.1.2       later_1.0.0       grid_3.6.1        nlme_3.1-140     
[45] jsonlite_1.6      gtable_0.3.0      lifecycle_0.1.0   DBI_1.0.0        
[49] git2r_0.26.1      magrittr_1.5      scales_1.1.0      cli_1.1.0        
[53] stringi_1.4.3     farver_2.0.1      fs_1.3.1          promises_1.1.0   
[57] xml2_1.2.2        generics_0.0.2    vctrs_0.2.0       boot_1.3-22      
[61] tools_3.6.1       glue_1.3.1        hms_0.5.2         parallel_3.6.1   
[65] yaml_2.2.0        colorspace_1.4-1  rvest_0.3.5       knitr_1.26       
[69] haven_2.2.0