se.from.p: Calculate the standard error from the effect size and p-value

View source: R/SE_from_p.R

se.from.pR Documentation

Calculate the standard error from the effect size and p-value

Description

This function calculates the standard error of an effect size provided the exact p-value and (continuous) effect size according to the formula by Altman and Bland (2011).

Usage

se.from.p(effect.size, p, N, effect.size.type = 'difference',
    calculate.g = FALSE)

Arguments

effect.size

Numeric vector or single number. The effect size, such as the standardized mean difference, Hedges' g or other continuous effect size.

p

Numeric vector or single number. The exact p-value corresponding to the effect size.

N

Numeric vector or single number. The total number of samples used to calculate the effect size/p-value.

effect.size.type

The type of effect sizes provided in effect.size. For effect sizes based on differences (e.g., mean differences), this parameter has to be set to "difference". For effect sizes based on ratios (e.g., risk ratio, odds ratio), this parameter has to be set to "ratio".

calculate.g

Logical. Calculates the standardized mean difference corrected for small sample bias (Hedges' g). FALSE by default.

Details

This function calculates the standard error, standard deviation and 95% confidence interval of an effect size given the effect size and exact p-value. The function can be used for:

  • effect sizes based on differences (e.g., mean differences) by setting effect.size.type to "difference", or

  • effect sizes based on ratios (e.g. risk ratios, odds ratios or hazard ratios) by setting effect.size.type to "ratio". When ratios are used, the function returns the log-transformed effect sizes, standard error, standard deviation and confidence interval, which can be used for meta-analytic pooling using the metagen function, along with the original effect size and confidence interval.

Value

A dataframe containing the following columns:

  • (log)EffectSize: The input effect size. Log-transformed if effect.size.type is "ratio".

  • Hedges.g: The calculated Hedges' g values (only if calculate.g=TRUE).

  • (log)StandardError: The standard error (SE) for the effect size. Log-transformed if effect.size.type is "ratio".

  • (log)LLCI and (log)ULCI: The lower and upper 95% confidence interval of the effect size. Log-transformed if effect.size.type="ratio".

Author(s)

Mathias Harrer & David Daniel Ebert

References

Altman D.G. & Bland J.M. (2011) How to obtain the confidence interval of a p value. BMJ 343:d2090.

Examples

# Example 1: one single effect size
se.from.p(effect.size = 0.71, p = 0.013, N = 75,
    effect.size.type= "difference", calculate.g = TRUE)

# Example 2: vector of effect sizes (Odds Ratio)
effect.size = c(0.91, 1.01, 0.72, 0.43)
p = c(0.05, 0.031, 0.001, 0.09)
N = c(120, 86, 450, 123)
se.from.p(effect.size = effect.size, p = p, N = N,
    effect.size.type = "ratio")

MathiasHarrer/dmetar documentation built on April 4, 2024, 6:57 p.m.