Last updated: 2020-05-06
Checks: 6 1
Knit directory: mcfa-para-est/
This reproducible R Markdown analysis was created with workflowr (version 1.6.1). 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 95dd5a6. 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: 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: LICENSE.txt
Untracked: analysis/ml-cfa-ci-coverage.Rmd
Untracked: analysis/ml-cfa-parameter-bias-level2-residual-variances.Rmd
Untracked: analysis/ml-cfa-parameter-convergence-correlation-L1-factor-covariance.Rmd
Untracked: analysis/ml-cfa-parameter-convergence-correlation-L2-factor-covariance.Rmd
Untracked: analysis/ml-cfa-parameter-convergence-correlation-L2-factor-variances.Rmd
Untracked: analysis/ml-cfa-parameter-convergence-correlation-L2-residual-variances.Rmd
Untracked: analysis/ml-cfa-parameter-convergence-correlation-factor-loadings.Rmd
Unstaged changes:
Modified: .gitignore
Modified: analysis/index.Rmd
Modified: analysis/license.Rmd
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"))
# subset to data with admissible replications
sim_results <- filter(sim_results, Converge==1 & Admissible==1)
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 MplusAutomation_0.7-3
[4] data.table_1.12.8 patchwork_1.0.0 forcats_0.5.0
[7] stringr_1.4.0 dplyr_0.8.5 purrr_0.3.4
[10] readr_1.3.1 tidyr_1.0.2 tibble_3.0.1
[13] ggplot2_3.3.0 tidyverse_1.3.0 workflowr_1.6.1
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.6 reprex_0.3.0 evaluate_0.14
[13] coda_0.19-3 httr_1.4.1 pillar_1.4.3 rlang_0.4.5
[17] readxl_1.3.1 rstudioapi_0.11 texreg_1.36.23 gsubfn_0.7
[21] rmarkdown_2.1 proto_1.0.0 webshot_0.5.2 pander_0.6.3
[25] munsell_0.5.0 broom_0.5.6 compiler_3.6.3 httpuv_1.5.2
[29] modelr_0.1.7 xfun_0.13 pkgconfig_2.0.3 htmltools_0.4.0
[33] tidyselect_1.0.0 viridisLite_0.3.0 fansi_0.4.1 crayon_1.3.4
[37] dbplyr_1.4.3 withr_2.2.0 later_1.0.0 grid_3.6.3
[41] nlme_3.1-144 jsonlite_1.6.1 gtable_0.3.0 lifecycle_0.2.0
[45] DBI_1.1.0 git2r_0.26.1 magrittr_1.5 scales_1.1.0
[49] cli_2.0.2 stringi_1.4.6 fs_1.4.1 promises_1.1.0
[53] xml2_1.3.2 ellipsis_0.3.0 generics_0.0.2 vctrs_0.2.4
[57] boot_1.3-24 tools_3.6.3 glue_1.4.0 hms_0.5.3
[61] parallel_3.6.3 yaml_2.2.1 colorspace_1.4-1 rvest_0.3.5
[65] knitr_1.28 haven_2.2.0
On this page, we are investigating the correlation among parameter estimates between estimation methods. We do this by
# keep variables
keepVar <- c("Condition", "Replication", "ss_l1", "ss_l2", "icc_ov", "icc_lv", "Estimator", "psiB12")
sim_res1 <- sim_results[, keepVar]
sim_res1 <- sim_res1%>%
pivot_wider(id_cols=c("Condition","Replication", "ss_l1", "ss_l2", "icc_ov", "icc_lv"),
names_from = "Estimator",
values_from = "psiB12")
cor.est <- sim_res1 %>%
group_by(ss_l1, ss_l2, icc_ov, icc_lv) %>%
summarise(
r_mlr_ulsmv = cor(MLR, ULSMV,use = "pairwise.complete"),
cprop_mlr_ulsmv = (1-(sum(is.na(MLR + ULSMV))/500)) ,
r_mlr_wlsmv = cor(MLR, WLSMV,use = "pairwise.complete"),
cprop_mlr_wlsmv = (1-(sum(is.na(MLR + WLSMV))/500)),
r_ulsmv_wlsmv = cor(ULSMV, WLSMV,use = "pairwise.complete"),
cprop_ulsmv_wlsmv = (1-(sum(is.na(ULSMV + WLSMV))/500))
)
a1 <- cor.est %>%
pivot_longer(cols= starts_with("r_"),
names_to= "Cor",
values_to = "Est") %>%
mutate(Cor = substring(Cor, 3))
a2 <- cor.est %>%
pivot_longer(cols= starts_with("cprop_"),
names_to= "Cor",
values_to = "Cprop")%>%
mutate(Cor = substring(Cor, 7))
cor.est <- left_join(a1[,c(1:4,8:9)], a2[,c(1:4,8:9)])
Joining, by = c("ss_l1", "ss_l2", "icc_ov", "icc_lv", "Cor")
cor.est$Cor <- factor(cor.est$Cor,
levels=c("mlr_ulsmv", "mlr_wlsmv", "ulsmv_wlsmv"),
labels=c("cor(MLR, ULSMV)",
"cor(MLR, WLSMV)",
"cor(ULSMV, WLSMV)"),
ordered=T)
cor.est$C90 <- as.factor(ifelse(cor.est$Cprop >= 0.9, ">= 90%", "< 90%"))
cor.est$C95 <- as.factor(ifelse(cor.est$Cprop >= 0.95, ">= 95%", "< 95%"))
cols=c("< 90%"="#56B4E9", ">= 90%"="#CC79A7")
p <- ggplot(cor.est, aes(x=Cor, y=Est)) +
geom_boxplot(outlier.shape = NA) +
geom_jitter(data=filter(cor.est, C90=="< 90%"),
width=0.3, aes(x=Cor, y=Est, color="< 90%")) +
geom_jitter(data=filter(cor.est, C90==">= 90%"),
width=0.3, aes(x=Cor, y=Est, color=">= 90%")) +
lims(y=c(0,1))+
labs(y="Correlation between Estimates",
x=NULL,
title="Correlation amoung Estimates: Level-2 Factor Covariance")+
scale_color_manual(name="% Admissible", values=cols)+
theme_bw()+
theme(panel.grid = element_blank())
p
p <- ggplot(cor.est, aes(x=Cor, y=Est)) +
geom_boxplot(outlier.shape = NA) +
geom_jitter(data=filter(cor.est, C90=="< 90%"),
width=0.3, aes(x=Cor, y=Est, color="< 90%")) +
geom_jitter(data=filter(cor.est, C90==">= 90%"),
width=0.3, aes(x=Cor, y=Est, color=">= 90%")) +
lims(y=c(0,1))+
labs(y="Correlation between Estimates",
x=NULL,
title="Correlation amoung Estimates: Level-2 Factor Covariance",
subtitle = "Conditional on Level-1 Sample Size")+
scale_color_manual(name="% Admissible", values=cols)+
facet_wrap(.~ss_l1)+
theme_bw()+
theme(panel.grid = element_blank(),
axis.text.x = element_text(angle=90))
p
p <- ggplot(cor.est, aes(x=Cor, y=Est)) +
geom_boxplot(outlier.shape = NA) +
geom_jitter(data=filter(cor.est, C90=="< 90%"),
width=0.3, aes(x=Cor, y=Est, color="< 90%")) +
geom_jitter(data=filter(cor.est, C90==">= 90%"),
width=0.3, aes(x=Cor, y=Est, color=">= 90%")) +
lims(y=c(0,1))+
labs(y="Correlation between Estimates",
x=NULL,
title="Correlation amoung Estimates: Level-2 Factor Covariance",
subtitle = "Conditional on Level-2 Sample Size")+
scale_color_manual(name="% Admissible", values=cols)+
facet_wrap(.~ss_l2, nrow=1)+
theme_bw()+
theme(panel.grid = element_blank(),
axis.text.x = element_text(angle=90))
p
p <- ggplot(cor.est, aes(x=Cor, y=Est)) +
geom_boxplot(outlier.shape = NA) +
geom_jitter(data=filter(cor.est, C90=="< 90%"),
width=0.3, aes(x=Cor, y=Est, color="< 90%")) +
geom_jitter(data=filter(cor.est, C90==">= 90%"),
width=0.3, aes(x=Cor, y=Est, color=">= 90%")) +
lims(y=c(0,1))+
labs(y="Correlation between Estimates",
x=NULL,
title="Correlation amoung Estimates: Level-2 Factor Covariance",
subtitle = "Conditional on Observed Variable ICC")+
scale_color_manual(name="% Admissible", values=cols)+
facet_wrap(.~icc_ov)+
theme_bw()+
theme(panel.grid = element_blank(),
axis.text.x = element_text(angle=90))
p
p <- ggplot(cor.est, aes(x=Cor, y=Est)) +
geom_boxplot(outlier.shape = NA) +
geom_jitter(data=filter(cor.est, C90=="< 90%"),
width=0.3, aes(x=Cor, y=Est, color="< 90%")) +
geom_jitter(data=filter(cor.est, C90==">= 90%"),
width=0.3, aes(x=Cor, y=Est, color=">= 90%")) +
lims(y=c(0,1))+
labs(y="Correlation between Estimates",
x=NULL,
title="Correlation amoung Estimates: Level-2 Factor Covariance",
subtitle = "Conditional on Latent Variable ICC")+
scale_color_manual(name="% Admissible", values=cols)+
facet_wrap(.~icc_lv)+
theme_bw()+
theme(panel.grid = element_blank(),
axis.text.x = element_text(angle=90))
p
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 MplusAutomation_0.7-3
[4] data.table_1.12.8 patchwork_1.0.0 forcats_0.5.0
[7] stringr_1.4.0 dplyr_0.8.5 purrr_0.3.4
[10] readr_1.3.1 tidyr_1.0.2 tibble_3.0.1
[13] ggplot2_3.3.0 tidyverse_1.3.0 workflowr_1.6.1
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.6 reprex_0.3.0 evaluate_0.14
[13] coda_0.19-3 httr_1.4.1 pillar_1.4.3 rlang_0.4.5
[17] readxl_1.3.1 rstudioapi_0.11 texreg_1.36.23 gsubfn_0.7
[21] rmarkdown_2.1 labeling_0.3 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.7 xfun_0.13 pkgconfig_2.0.3
[33] htmltools_0.4.0 tidyselect_1.0.0 viridisLite_0.3.0 fansi_0.4.1
[37] crayon_1.3.4 dbplyr_1.4.3 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.26.1 magrittr_1.5
[49] scales_1.1.0 cli_2.0.2 stringi_1.4.6 farver_2.0.3
[53] fs_1.4.1 promises_1.1.0 xml2_1.3.2 ellipsis_0.3.0
[57] generics_0.0.2 vctrs_0.2.4 boot_1.3-24 tools_3.6.3
[61] glue_1.4.0 hms_0.5.3 parallel_3.6.3 yaml_2.2.1
[65] colorspace_1.4-1 rvest_0.3.5 knitr_1.28 haven_2.2.0