The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Introduction to metacor

metacor: Meta-analysis with correlated data

The metacor package provides tools for conducting meta-analyses when your effect sizes involve pre-post correlations, missing SDs, and flexible imputation methods. It is especially useful for single-group or controlled designs with incomplete data.

Main Features

Quick Start Example

Let’s illustrate a simple workflow with example data:

library(metacor)

# Example dataset (for pre/post design only)
df <- data.frame(
  study_name = c("Study1", "Study2", "Study3", "Study4","Study5", "Study6", "Study7", "Study8", "Study9"),
  p_value_Int = c(1.038814e-07, NA, NA, NA, NA, 2.100000e-02, NA, NA, NA),
  n_Int = c(10, 10, 10, 10, 15, 15, 10, 10, 10),
  meanPre_Int = c(8.17, 10.09, 10.18, 9.85, 9.51,7.70, 10.00,  11.53, 11.20),
  meanPost_Int = c(10.12, 12.50, 12.56,10.41, 10.88, 9.20, 10.80,13.42,12.00),
  sd_pre_Int = c(1.83,0.67,0.66,0.90,0.62, 0.90, 0.70, 0.60, 1.90),
  sd_post_Int = c(1.85, 0.72, 0.97, 0.67, 0.76, 1.10, 0.70,0.80,1.80),
  upperCI_Int = c(NA, NA,NA, NA,NA, NA,NA, NA, NA),
  lowerCI_Int = c(NA, NA,NA, NA,NA, NA,NA, NA, NA))

results <- metacor_dual(df,
                        digits = 3,
                        method = "both",
                        apply_hedges = TRUE,
                        add_to_df = TRUE,
                        SMD_method = "SMDpre",
                        MeanDifferences = TRUE,
                        impute_method = "cv",
                        verbose = TRUE,
                        report_imputations = TRUE,
                        custom_sd_diff_int = NULL,
                        custom_sd_diff_con = NULL,
                        single_group = TRUE)
#> Imputed sd_diff_int at row 2 using 'cv' (0.8494): 2.0470
#> Warning in metacor_dual(df, digits = 3, method = "both", apply_hedges = TRUE, : Row 2: Imputed sd_diff_int = 2.0470 gives r_int = -3.3405 (outside [-0.9999, 0.9999]).
#> Suggested sd_diff_int range: [0.0510, 1.3900].
#>  r_int not assigned.
#> Imputed sd_diff_int at row 3 using 'cv' (0.8494): 2.0215
#> Warning in metacor_dual(df, digits = 3, method = "both", apply_hedges = TRUE, : Row 3: Imputed sd_diff_int = 2.0215 gives r_int = -2.1166 (outside [-0.9999, 0.9999]).
#> Suggested sd_diff_int range: [0.3102, 1.6300].
#>  r_int not assigned.
#> Imputed sd_diff_int at row 4 using 'cv' (0.8494): 0.4757
#> Imputed sd_diff_int at row 5 using 'cv' (0.8494): 1.1636
#> Imputed sd_diff_int at row 7 using 'cv' (0.8494): 0.6795
#> Imputed sd_diff_int at row 8 using 'cv' (0.8494): 1.6053
#> Warning in metacor_dual(df, digits = 3, method = "both", apply_hedges = TRUE, : Row 8: Imputed sd_diff_int = 1.6053 gives r_int = -1.6428 (outside [-0.9999, 0.9999]).
#> Suggested sd_diff_int range: [0.2002, 1.4000].
#>  r_int not assigned.
#> Imputed sd_diff_int at row 9 using 'cv' (0.8494): 0.6795

Imputation and Reporting

If your dataset has missing values for correlations or SD differences, metacor_dual() will automatically perform imputations based on the method you choose (e.g., “direct”, “mean”, “cv”). You can also request a Word report with all imputations performed by setting the argument report_imputations = TRUE.

result <- metacor_dual(df, report_imputations = TRUE)
#> Warning in metacor_dual(df, report_imputations = TRUE): No real SD diff values
#> available to impute (con).

The report will be saved as imputation_report.docx in your working directory.

Advanced Usage

You can customise the imputation methods and other arguments. For more details, see the documentation:

?metacor_dual

References

Fu, R., Vandermeer, B. W., Shamliyan, T. A., O’Neil, M. E., Yazdi, F., Fox, S. H., & Morton, S. C. (2013). Handling Continuous Outcomes in Quantitative Synthesis. Methods Guide for Comparative Effectiveness Reviews. AHRQ Publication No. 13-EHC103-EF. Link

Session info

sessionInfo()
#> R version 4.3.1 (2023-06-16)
#> Platform: aarch64-apple-darwin20 (64-bit)
#> Running under: macOS 15.5
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
#> 
#> locale:
#> [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> time zone: Europe/Madrid
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] metacor_1.1.1
#> 
#> loaded via a namespace (and not attached):
#>  [1] vctrs_0.6.5       zip_2.3.1         cli_3.6.3         knitr_1.48       
#>  [5] rlang_1.1.4       xfun_0.46         stringi_1.8.4     textshaping_0.4.0
#>  [9] jsonlite_1.8.8    glue_1.8.0        openssl_2.2.0     askpass_1.2.0    
#> [13] htmltools_0.5.8.1 ragg_1.4.0        sass_0.4.9        rmarkdown_2.27   
#> [17] evaluate_1.0.4    jquerylib_0.1.4   fastmap_1.2.0     yaml_2.3.10      
#> [21] lifecycle_1.0.4   stringr_1.5.1     compiler_4.3.1    officer_0.6.10   
#> [25] rstudioapi_0.16.0 systemfonts_1.1.0 digest_0.6.36     R6_2.5.1         
#> [29] magrittr_2.0.3    bslib_0.7.0       uuid_1.2-0        tools_4.3.1      
#> [33] xml2_1.3.6        cachem_1.1.0

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.