| Title: | Transforms Statistical Measures Commonly Used for Meta-Analysis |
| Version: | 1.0.1 |
| Description: | Helps calculate statistical values commonly used in meta-analysis. It provides several methods to compute different forms of standardized mean differences, as well as other values such as standard errors and standard deviations. The methods used in this package are described in the following references: Altman D G, Bland J M. (2011) <doi:10.1136/bmj.d2090> Borenstein, M., Hedges, L.V., Higgins, J.P.T. and Rothstein, H.R. (2009) <doi:10.1002/9780470743386.ch4> Chinn S. (2000) <doi:10.1002/1097-0258(20001130)19:22%3C3127::aid-sim784%3E3.0.co;2-m> Cochrane Handbook (2011) https://www.cochrane.org/authors/handbooks-and-manuals/handbook/archive/v5.1.0 Cooper, H., Hedges, L. V., & Valentine, J. C. (2009) https://psycnet.apa.org/record/2009-05060-000 Cohen, J. (1977) https://psycnet.apa.org/record/1987-98267-000 Ellis, P.D. (2009) https://www.psychometrica.de/effect_size.html Goulet-Pelletier, J.-C., & Cousineau, D. (2018) <doi:10.20982/tqmp.14.4.p242> Hedges, L. V. (1981) <doi:10.2307/1164588> Hedges L. V., Olkin I. (1985) <doi:10.1016/C2009-0-03396-0> Murad M H, Wang Z, Zhu Y, Saadi S, Chu H, Lin L et al. (2023) <doi:10.1136/bmj-2022-073141> Mayer M (2023) https://search.r-project.org/CRAN/refmans/confintr/html/ci_proportion.html Stackoverflow (2014) https://stats.stackexchange.com/questions/82720/confidence-interval-around-binomial-estimate-of-0-or-1 Stackoverflow (2018) https://stats.stackexchange.com/q/338043. |
| License: | MIT + file LICENSE |
| Depends: | R (≥ 4.6.0) |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Imports: | magrittr, stats, confintr |
| URL: | https://github.com/RobertEmprechtinger/metaHelper |
| BugReports: | https://github.com/RobertEmprechtinger/metaHelper/issues |
| Date: | 2026-06-18 |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2026-06-18 10:11:19 UTC; empre |
| Author: | Robert Emprechtinger
|
| Maintainer: | Robert Emprechtinger <emprechtinger@stateofhealth.at> |
| Repository: | CRAN |
| Date/Publication: | 2026-06-18 11:10:02 UTC |
Absolute Risk Difference
Description
Calculates the Absolute Risk Difference (ARD) from a Risk Ratio and baseline risk using simulations. The result is ARD as a decimal. The number of replications is fixed at 100,000.
Usage
ARD_from_RR(BR, BRLL, BRUL, RR, RRLL, RRUL, seed = 1)
Arguments
BR |
baseline risk |
BRLL |
baseline risk lower limit confidence interval |
BRUL |
baseline risk upper limit confidence interval |
RR |
risk ratio |
RRLL |
risk ratio lower limit confidence interval |
RRUL |
risk ratio upper limit confidence interval |
seed |
seed that is used for the simulation to ensure reproducibility |
Value
Named numeric vector containing median ARD, the lower and upper CI of the ARD.
References
Murad M H, Wang Z, Zhu Y, Saadi S, Chu H, Lin L et al. Methods for deriving risk difference (absolute risk reduction) from a meta-analysis BMJ 2023; 381 :e073141 doi:10.1136/bmj-2022-073141
Examples
# Input : Baseline risk and 95% CI (BR BRLL and BRUL), risk ratio and 95% CI (RR, RRLL, RRUL)
BR <- 0.053; BRLL <- 0.039; BRUL <- 0.072
RR <- 0.77; RRLL <- 0.63; RRUL <- 0.94
ARD_from_RR(BR, BRLL, BRUL, RR, RRLL, RRUL)
Confidence Interval for Proportions
Description
Calculates a confidence interval for proportions. For a discussion on the differences between methods to calculate confidence intervals, see the Stack Overflow discussion under References. This method uses the R package "confintr" to calculate the confidence intervals.
Usage
CI_from_proportions(events, n, method = "Clopper-Pearson")
Arguments
events |
number of events |
n |
sample size |
method |
the method ("Clopper-Pearson", "Agresti-Coull", "Wilson") that should be used to calculate the confidence intervals. |
Value
List of confidence interval of proportions if input length > 1. If input length = 1 Lower CI and Upper CI.
References
Confintr Function Description Stackoverflow Method Discussion
Examples
# CI for 9 events in a sample of 10
CI_from_proportions(9, 10)
Combined Standard Deviation for Multiple Groups
Description
Computes the pooled standard deviation for multiple groups.
Usage
SD_M_n_pooled_from_groups(M, SD, n)
Arguments
M |
vector of group means |
SD |
vector of group SDs |
n |
vector of group sample sizes |
Details
This function also returns the combined mean and the total sample size across all groups.
Use this function to combine subgroups into one combined group. This requires subgroup means, SDs, and sample sizes. SDp_from_SD() calculates a pooled within group SD denominator for two independent groups and is not the same as combining subgroups into one group when subgroup means differ.
Value
Within standard deviation
References
Rücker G, Cates CJ, Schwarzer G. Methods for including information from multi-arm trials in pairwise meta-analysis. Res Synth Methods. 2017 Dec;8(4):392-403. doi: 10.1002/jrsm.1259. Epub 2017 Aug 25. PMID: 28759708.
Examples
# Compute the Standard deviation for the following grouped data
M <- c(1, 1.5, 2) # Means
SD <- c(2, 3, 2.5) # SDs
n <- c(72, 80, 55) # sample sizes
SD_M_n_pooled_from_groups(M, SD, n)
Standard Deviation from Confidence Interval
Description
Computes the standard deviation from a CI around one group mean and sample size. This method is valid only for single groups and assumes the confidence interval is symmetric around the mean. For two groups, use SDp_from_CIp() only when the CI is around a raw mean difference from two independent groups. Small samples should generally use the t distribution (t_dist = TRUE).
Usage
SD_from_CI(CI_low, CI_up, n, sig_level = 0.05, two_sided = TRUE, t_dist = TRUE)
Arguments
CI_low |
lower limit confidence interval |
CI_up |
upper limit confidence interval |
n |
sample size |
sig_level |
significance level |
two_sided |
whether a two sided test for significance was used |
t_dist |
whether a t-distribution has been used to calculate the CI. See description. |
Value
Standard deviation single group
References
See Also
SDp_from_CIp() for a CI around a raw mean difference from two independent groups.
Examples
# lower CI = -0.5, upper CI = 2, sample size = 100
SD_from_CI(-0.5, 2, 100)
Standard Deviation from Standard Error (Single Group)
Description
Use only when SE is the standard error around one group mean. Do not use for the SE of a mean difference or treatment contrast. Calculates the standard deviation from the standard error for a single group mean.
Usage
SD_from_SE(SE, n)
Arguments
SE |
standard error |
n |
sample size |
Value
Single group standard deviation
References
See Also
SDp_from_SEp() for the SE of a raw mean difference from two independent groups.
Examples
# Standard error = 2 and sample size = 100
SE <- 2
n <- 100
SD_from_SE(SE, n)
Within-Group Standard Deviation for Matched Groups
Description
Computes the within-group standard deviation for matched groups. This within-group standard deviation can be used to calculate standardized mean differences for matched groups. This method requires a correlation coefficient r.
Usage
SD_within_from_SD_r(SD_diff, r)
Arguments
SD_diff |
standard deviation of the difference |
r |
correlation between pair of observations |
Value
Within standard deviation
References
Borenstein, M., Hedges, L.V., Higgins, J.P.T. and Rothstein, H.R. (2009). Effect Sizes Based on Means . In Introduction to Meta-Analysis (eds M. Borenstein, L.V. Hedges, J.P.T. Higgins and H.R. Rothstein). https://doi.org/10.1002/9780470743386.ch4
Examples
# SD_diff is the standard deviation of the group difference
SD_diff <- 2
# r is the correlation coefficient between the groups
r <- 0.5
SD_within_from_SD_r(SD_diff, r)
Pooled Standard Deviation from Confidence Interval
Description
Computes the implied pooled within-group SD under the equal outcome SD assumption for the two groups from a CI around a raw mean difference from two independent groups. The output is not the SD of the effect. This method is valid only if the confidence interval is symmetric around the raw mean difference and if either the t distribution or normal distribution (when t_dist = FALSE) was used to calculate the confidence interval.
Usage
SDp_from_CIp(
CI_low,
CI_up,
n1,
n2,
sig_level = 0.05,
two_sided = TRUE,
t_dist = TRUE
)
Arguments
CI_low |
lower limit confidence interval |
CI_up |
upper limit confidence interval |
n1 |
sample size group 1 |
n2 |
sample size group 2 |
sig_level |
significance level |
two_sided |
whether a two sided test for significance was used |
t_dist |
whether a t distribution has been used to calculate the CI |
Value
Pooled standard deviation
References
See Also
SD_from_CI() for single group standard deviation.
Examples
#lower CI = 0.5, upper CI = 0.7, N1 = 50, N2 = 70
SDp_from_CIp(0.5, 0.7, 50, 70)
Pooled Standard Deviation from Two Standard Deviations
Description
Calculates the pooled standard deviation.
Usage
SDp_from_SD(SD1, SD2, n1 = NA, n2 = NA, method = "hedges")
Arguments
SD1 |
standard deviation of group 1 |
SD2 |
standard deviation of group 2 |
n1 |
sample size of group 1 |
n2 |
sample size of group 2 |
method |
the method ("hedges", "cohen") that should be used to calculate the SD. Method "hedges" requires sample sizes. The "cohen" method uses a simplified method by and does not rely on sample sizes. |
Details
The method according to Hedges requires the sample sizes. If only standard deviations are available, the simpler equation provided by Cohen (1988) can be used. If there are more than two groups, SD_M_n_pooled_from_groups() should be used.
Note: The use of the names "Cohen" and "Hedges" for the methods can be inconsistent in the literature. It is somewhat unusual because Cohen (1977) outlined both estimators for the pooled standard deviation before Hedges (1981) discussed them.
Value
Pooled standard deviation
References
Borenstein, M., Hedges, L.V., Higgins, J.P.T. and Rothstein, H.R. (2009). Converting Among Effect Sizes. In Introduction to Meta-Analysis (eds M. Borenstein, L.V. Hedges, J.P.T. Higgins and H.R. Rothstein). https://doi.org/10.1002/9780470743386.ch7
Cohen, J. (1977). Statistical power analysis for the behavioral sciences (2nd ed.). Hillsdale, NJ, US: Lawrence Erlbaum Associates, Inc.
Ellis, P.D. (2009), "Effect size equations". Link
Hedges, L. V. (1981). Distribution theory for Glass's estimator of effect size and related estimators. Journal of Educational Statistics, 6, 107-128.
Difference between Cohen's d and Hedges' g for effect size metrics. Stackoverflow. Link
See Also
SD_within_from_SD_r() for matched groups
Examples
# Standard deviation according to Cohen:
SDp_from_SD(2, 3, method = "cohen")
# Standard deviation according to Hedges needs sample sizes:
SDp_from_SD(2, 3, 50, 50)
Pooled Within-Group Standard Deviation from SE of Raw Mean Difference
Description
IMPORTANT: For a single group, use SD_from_SE()!
Calculates the implied pooled within-group standard deviation from the SE of a raw mean difference from two independent groups and their sample sizes. This method is the reverse of SEp_from_SDp() under the equal SD assumption.
Do not use with SEs for SMDs, odds ratios, risk ratios, hazard ratios, log effects, adjusted model estimates when reconstructing raw SDs, Welch tests, or paired designs.
Usage
SDp_from_SEp(SEp, n1, n2)
Arguments
SEp |
SE of a raw mean difference from two independent groups |
n1 |
sample size group 1 |
n2 |
sample size group 2 |
Value
Pooled standard deviation
References
See Also
SD_from_SE() for a single group.
SEp_from_SDp() if the standard error should be computed instead.
Examples
# SE of a raw mean difference, sample size 1 and sample size 2
SE <- 0.12
n1 <- 140
n2 <- 140
SDp_from_SEp(SE, n1, n2)
Standard Error of from Confidence Intervals of Odds Ratio
Description
Calculates the standard error from an odds ratio confidence interval.
Usage
SE.SMD_from_OR.CI(CI_low, CI_up, sig_level = 0.05, two_tailed = TRUE)
Arguments
CI_low |
lower odds ratio confidence interval limit |
CI_up |
upper odds ratio confidence interval limit |
sig_level |
the significance level |
two_tailed |
whether the two-tailed or one-tailed z statistics should be calculated |
Details
This method uses multiple steps in the background: 1 Takes odds ratio (OR) limits and transforms them to log(OR) 2 Calculates the standard error for the log(OR) 3 Transforms the log(OR) standard error to standardized mean differences (SMD) standard error by multiplying it with sqrt(3)/pi
Value
Standard Error
References
Chinn S. A simple method for converting an odds ratio to effect size for use in meta-analysis. Stat Med. 2000 Nov 30;19(22):3127-31. doi: 10.1002/1097-0258(20001130)
Examples
# lower CI = 0.6, upper CI = 0.9
SE.SMD_from_OR.CI(0.6, 0.9)
Standard Error from Sample Sizes and SMD
Description
Approximates SMD standard error from sample sizes and SMD.
Usage
SE.SMD_from_SMD(SMD, n1, n2, method = "hedges")
Arguments
SMD |
standardized mean differences |
n1 |
sample size group 1 |
n2 |
sample size group 2 |
method |
transformation method ("hedges", "cohen") |
Value
Standard error of SMD (e.g. standard error of intervention effect)
References
Cooper, H., Hedges, L. V., & Valentine, J. C. (Eds.). (2009). Link
Examples
# SMD = 0.6, sample size group_1 = 50, sample size group_2 = 75
SE.SMD_from_SMD(0.6, 50, 75)
Standard Error for a Single Group
Description
IMPORTANT: For cases involving two groups (e.g., intervention effects), use SEp_from_SDp() instead.#'
Calculates the standard error for a single group. This method is only valid for single groups
Usage
SE_from_SD(SD, n)
Arguments
SD |
standard deviation |
n |
sample size |
Value
Single group standard error
References
See Also
SEp_from_SDp() for two groups
Examples
# Standard deviation = 2, group size = 50
SE_from_SD(2, 50)
Standard Error from Confidence Interval for Mean Differences
Description
Calculates the standard error from the confidence interval limits for differences of means.
For SMD confidence intervals, this function can recover an SE for generic inverse variance meta-analysis. Keep that SE separate from raw SD recovery: do not pass an SE from an SMD CI into SDp_from_SEp() to recover a raw pooled SD.
This method is valid only when the confidence interval is symmetrical around the mean and is applicable for t-distributions or normal distributions (as specified by the t_dist argument).
For sample sizes less than 60, it is generally recommended to use the t-distribution.
Usage
SEp_from_CIp(
CI_low,
CI_up,
n1 = NA,
n2 = NA,
sig_level = 0.05,
two_tailed = TRUE,
t_dist = TRUE
)
Arguments
CI_low |
lower CI limit |
CI_up |
upper CI limit |
n1 |
sample size group 1 (not required if t_dist = FALSE) |
n2 |
sample size group 2 (not required if t_dist = FALSE) |
sig_level |
the significance level |
two_tailed |
whether the two-tailed or one-tailed statistics should be calculated |
t_dist |
whether the t-distribution should be calculated - requires samples sizes |
Value
Standard error of the effect estimate
References
Examples
# lower CI = -1.5, upper CI = 0.5
SEp_from_CIp(-1.5, 0.5)
Standard Error (Pooled)
Description
IMPORTANT: When there is only one group, the following method has to be used: SE_from_SD()
Calculates the pooled standard error for two groups (e.g., intervention effect).
Usage
SEp_from_SDp(SDp, n1, n2)
Arguments
SDp |
pooled standard deviation |
n1 |
sample size group 1 |
n2 |
sample size group 2 |
Value
Pooled standard error for two groups (e.g. standard error of intervention effect)
References
See Also
SE_from_SD() for a single group
Examples
# Pooled standard deviation = 2, sample size group a = 50, sample size group b = 75
SEp_from_SDp(2, 50, 75)
Standard Error from Effect Estimate and p-Value
Description
Calculates the standard error using the effect estimate and p-value. The default method = "z" is a z-based Wald-style SE recovery helper for effect estimates. For SD recovery examples, pass the returned SE to SDp_from_SEp() only when the effect estimate is a raw mean difference from two independent groups.
The optional method = "t" uses a t distribution with df = n1 + n2 - 2 and is intended for small independent two group continuous outcomes. Cochrane describes the z-based p value route for Wald-style tests, but t tests for continuous outcome data should use the continuous outcome route instead.
To avoid an infinite return when p-value = 1, the p-value is automatically adjusted to 0.99999.
Usage
SEp_from_TE.p(TE, p, two_tailed = TRUE, method = "z", n1 = NA, n2 = NA)
Arguments
TE |
reported effect estimate |
p |
reported p-value |
two_tailed |
whether one-tailed or two-tailed statistics should be calculated |
method |
calculation method. Use |
n1 |
sample size group 1, required when |
n2 |
sample size group 2, required when |
Value
Standard error of the effect estimate
References
Altman D G, Bland J M. How to obtain the confidence interval from a P value BMJ 2011; 343 :d2090 doi:10.1136/bmj.d2090 Cochrane Handbook
Examples
# raw mean difference = 1.5, p = 0.8
SEp_from_TE.p(1.5, 0.8)
# t-based route for a small independent two group continuous outcome
SEp_from_TE.p(1.5, 0.8, method = "t", n1 = 12, n2 = 14)
Standardized Mean Difference from Odds Ratio
Description
Approximates SMD from OR.
Usage
SMD_from_OR(OR)
Arguments
OR |
odds ratio |
Value
Standardized Mean Difference
References
Borenstein, M., Hedges, L.V., Higgins, J.P.T. and Rothstein, H.R. (2009). Converting Among Effect Sizes. In Introduction to Meta-Analysis (eds M. Borenstein, L.V. Hedges, J.P.T. Higgins and H.R. Rothstein). https://doi.org/10.1002/9780470743386.ch7
Examples
# Transform an OR of 0.3 to SMD
SMD_from_OR(0.3)
Standardized Mean Differences from Group Data
Description
Calculates SMD directly from group data. Method "hedges" needs sample size data and returns Hedges' g. Method "cohen" returns Cohen's d.
Usage
SMD_from_group(M1, M2, SD1, SD2, n1 = NA, n2 = NA, method = "hedges")
Arguments
M1 |
treatment effect size group 1 |
M2 |
treatment effect size group 2 |
SD1 |
standard deviation group 1 |
SD2 |
standard deviation group 2 |
n1 |
sample size group 1 |
n2 |
sample size group 2 |
method |
calculation method ("hedges", "cohen") |
Value
Standardized Mean Differences
References
Borenstein, M., Hedges, L.V., Higgins, J.P.T. and Rothstein, H.R. (2009). Converting Among Effect Sizes. In Introduction to Meta-Analysis (eds M. Borenstein, L.V. Hedges, J.P.T. Higgins and H.R. Rothstein). https://doi.org/10.1002/9780470743386.ch7
Hedges L. V., Olkin I. (1985). Statistical methods for meta-analysis. San Diego, CA: Academic Press
Goulet-Pelletier, J.-C., & Cousineau, D. (2018). A review of effect sizes and their confidence intervals, Part 1: The Cohen’s d family. The Quantitative Methods for Psychology, 14(4), 242–265. https://doi.org/10.20982/tqmp.14.4.p242
Examples
# Mean control = 23, Mean intervention = 56, SD control = 30,
# SD intervention = 35, sample size control = 45, sample size intervention = 60
SMD_from_group(23, 56, 30, 35, 45, 60)
Standardized Mean Difference (SMD) from Means and Pooled Standard Deviation
Description
Calculates the SMD. It needs to be provided with the pooled standard deviation. If the pooled standard deviation is not available SMD_from_group() provides a direct method to calculate the SMD and also offers different forms like Hedges' g or Cohen's d.
Usage
SMD_from_mean(M1, M2, SD_pooled)
Arguments
M1 |
treatment effect size group 1 |
M2 |
treatment effect size group 2 |
SD_pooled |
the pooled standard deviation or the standard deviation of the control group in case Glass's delta should be calculated |
Details
CAVE: If you want to get Hedges' g it is insufficient to simply pool the standard deviation with SDp_from_SD(). The resulting SMD needs to be further multiplied with the hedges factor. This is done automatically when you use SMD_from_group().
Value
Standardized Mean Differences
References
https://www.cochrane.org/authors/handbooks-and-manuals/handbook/archive/v5.1.0
Examples
# Mean control = 153, Mean intervention = 136, pooled SD = 25
SMD_from_mean(153, 136, 25)
Calculates SMD from Matched Groups
Description
Calculates the standardized mean differences for matched groups. Needs either the mean of the groups or the difference between groups.
SD_within is usually not reported but can be calculated by the use of SD_within_from_SD_r().
Usage
SMD_from_mean_matched(M_diff = NA, M1 = NA, M2 = NA, SD_within)
Arguments
M_diff |
mean difference between groups |
M1 |
mean group 1 (in case M_diff not provided) |
M2 |
mean group 2 (in case M_diff not provided) |
SD_within |
within standard deviation. CAVE this is usually not reported but needs to be computed from the difference standard deviation.
This can be done with |
Value
Standardized Mean Differences
References
M., Hedges, L.V., Higgins, J.P.T. and Rothstein, H.R. (2009). Converting Among Effect Sizes. In Introduction to Meta-Analysis (eds M. Borenstein, L.V. Hedges, J.P.T. Higgins and H.R. Rothstein). https://doi.org/10.1002/9780470743386.ch7
Examples
# Calcuation with group means
SMD_from_mean_matched(M1 = 103, M2 = 100, SD_within = 7.1005)
# Calculation with group difference
SMD_from_mean_matched(M_diff = 3, SD_within = 7.1005)
# Calculation with standard deviation between
# Correlation Coefficient between groups
r <- 0.7
# SD between groups
SD_between <- 5.5
SMD_from_mean_matched(M_diff = 3,
SD_within = SD_within_from_SD_r(SD_between, r))