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

  • Calculates multiple effect sizes (SMDpre, SMDchange, ScMDpooled, etc.)
  • Handles missing correlations and SDs with advanced imputation methods
  • Produces detailed imputation reports (Word)
  • Flexible for intervention-only or control-intervention designs

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' (global median): 0.7200
#> Imputed sd_diff_int at row 3 using 'cv' (global median): 0.7111
#> Imputed sd_diff_int at row 4 using 'cv' (global median): 0.1673
#> Warning in metacor_dual(df, digits = 3, method = "both", apply_hedges = TRUE, : Row 4: Imputed sd_diff_int = 0.1673 gives r_int = 1.0207 (outside [-0.9999, 0.9999]).
#> Suggested sd_diff_int range: [0.2303, 1.5700].
#>  r_int not assigned.
#> Imputed sd_diff_int at row 5 using 'cv' (global median): 0.4093
#> Warning in metacor_dual(df, digits = 3, method = "both", apply_hedges = TRUE, : Row 6: Imputed sd_diff_int = 2.2349 gives r_int = -1.5024 (outside [-0.9999, 0.9999]).
#> Suggested sd_diff_int range: [0.2005, 2.0000].
#>  r_int not assigned.
#> Imputed sd_diff_int at row 7 using 'cv' (global median): 0.2390
#> Imputed sd_diff_int at row 8 using 'cv' (global median): 0.5647
#> Imputed sd_diff_int at row 9 using 'cv' (global median): 0.2390

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): Row 6: Imputed sd_diff_int = 2.2349 gives r_int = -1.5024 (outside [-0.9999, 0.9999]).
#> Suggested sd_diff_int range: [0.2005, 2.0000].
#>  r_int not assigned.

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.6.1 (2026-06-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 26.04 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so;  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] metacor_1.2.1  rmarkdown_2.31
#> 
#> loaded via a namespace (and not attached):
#>  [1] jsonlite_2.0.0    dplyr_1.2.1       compiler_4.6.1    zip_3.0.1        
#>  [5] tidyselect_1.2.1  stringr_1.6.0     xml2_1.6.0        tidyr_1.3.2      
#>  [9] jquerylib_0.1.4   systemfonts_1.3.2 textshaping_1.0.5 uuid_1.2-2       
#> [13] yaml_2.3.12       fastmap_1.2.0     R6_2.6.1          generics_0.1.4   
#> [17] knitr_1.51        tibble_3.3.1      maketools_1.3.2   openssl_2.4.2    
#> [21] bslib_0.11.0      pillar_1.11.1     rlang_1.3.0       stringi_1.8.7    
#> [25] cachem_1.1.0      xfun_0.60         sass_0.4.10       sys_3.4.3        
#> [29] otel_0.2.0        cli_3.6.6         magrittr_2.0.5    digest_0.6.39    
#> [33] askpass_1.2.1     lifecycle_1.0.5   vctrs_0.7.3       evaluate_1.0.5   
#> [37] glue_1.8.1        officer_0.7.5     ragg_1.5.2        buildtools_1.0.0 
#> [41] purrr_1.2.2       tools_4.6.1       pkgconfig_2.0.3   htmltools_0.5.9