--- title: "Introduction to metacor" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Introduction to metacor} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(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: ```{r} 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) ``` ## 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. ```{r} result <- metacor_dual(df, report_imputations = TRUE) ``` 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: ```{r} ?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 ```{r} sessionInfo() ``` ...