Skip to contents

R arm of morie.fn.evalu, evaltw and jntmed. Evalu: the E-value \(RR^* + \sqrt{RR^*(RR^* - 1)}\), \(RR^* = \max(RR, 1/RR)\), of an observed risk ratio and of the confidence limit closer to the null (1 when the interval covers 1). Evaltw is the same with the three numbers given positionally. Jntmed: fits \(M = i_1 + aX\) and \(Y = i_2 + c'X + bM\) by least squares and declares mediation when both \(a\) and \(b\) are significant; the p-value is \(\max(p_a, p_b)\).

Usage

Evalu(RR, ci_lower = NULL, ci_upper = NULL, rare_outcome = TRUE)

Evaltw(estimate, ci_lower, ci_upper)

Jntmed(x, m, y, alpha = 0.05)

Arguments

RR, estimate

Observed risk ratio (or a rare-outcome odds or hazard ratio).

ci_lower, ci_upper

Confidence limits on the same scale (optional for Evalu).

rare_outcome

Logical, recorded in the result (no transform is applied).

x, m, y

Treatment, mediator and outcome vectors.

alpha

Per-path significance level.

Value

A named list (the Python result's fields).

References

VanderWeele, T. J. and Ding, P. (2017). Sensitivity analysis in observational research: introducing the E-value. Annals of Internal Medicine 167(4), 268-274.

MacKinnon, D. P., Lockwood, C. M., Hoffman, J. M., West, S. G. and Sheets, V. (2002). A comparison of methods to test mediation and other intervening variable effects. Psychological Methods 7(1), 83-104.

Examples

Evalu(2, ci_lower = 1.3, ci_upper = 3.1)$evalue_ci
#> [1] 1.9245
Evaltw(0.5, 0.3, 0.8)$evalue
#> [1] 3.414214
Jntmed(0:7, c(0.3, 1.1, 1.6, 3.4, 3.9, 5.2, 6.4, 6.8),
       c(1, 1.9, 3.1, 4.4, 4.8, 6.9, 7.2, 8.1))$p_value
#> [1] 0.3810207