ab {gap} | R Documentation |
Test/Power calculation for mediating effect
Description
Test/Power calculation for mediating effect
Usage
ab(
type = "power",
n = 25000,
a = 0.15,
sa = 0.01,
b = log(1.19),
sb = 0.01,
alpha = 0.05,
fold = 1
)
Arguments
type |
string option: "test", "power". |
n |
default sample size to be used for power calculation. |
a |
regression coefficient from indepdendent variable to mediator. |
sa |
SE(a). |
b |
regression coefficient from mediator variable to outcome. |
sb |
SE(b). |
alpha |
size of siginficance test for power calculation. |
fold |
fold change for power calculation, as appropriate for a range of sample sizes. |
Details
This function tests for or obtains power of mediating effect based on estimates of two regression coefficients and their standard errors. Note that for binary outcome or mediator, one should use log-odds ratio and its standard error.
Value
The returned value are z-test and significance level for significant testing or sample size/power for a given fold change of the default sample size.
Author(s)
Jing Hua Zhao
References
Freathy RM, Timpson NJ, Lawlor DA, Pouta A, Ben-Shlomo Y, Ruokonen A, Ebrahim S, Shields B, Zeggini E, Weedon MN, Lindgren CM, Lango H, Melzer D, Ferrucci L, Paolisso G, Neville MJ, Karpe F, Palmer CN, Morris AD, Elliott P, Jarvelin MR, Smith GD, McCarthy MI, Hattersley AT, Frayling TM (2008). “Common variation in the FTO gene alters diabetes-related metabolic traits to the extent expected given its effect on BMI.” Diabetes, 57(5), 1419-26. ISSN 0012-1797 (Print) 0012-1797, doi:10.2337/db07-1466.
Kline RB. Principles and practice of structural equation modeling, Second Edition. The Guilford Press 2005.
MacKinnon DP. Introduction to Statistical Mediation Analysis. Taylor & Francis Group 2008.
Preacher KJ, Leonardelli GJ. Calculation for the Sobel Test-An interactive calculation tool for mediation tests https://quantpsy.org/sobel/sobel.htm
See Also
Examples
## Not run:
ab()
n <- power <- vector()
for (j in 1:10)
{
z <- ab(fold=j*0.01)
n[j] <- z[1]
power[j] <- z[2]
}
plot(n,power,xlab="Sample size",ylab="Power")
title("SNP-BMI-T2D association in EPIC-Norfolk study")
## End(Not run)