Description Usage Arguments Details Value References Examples
View source: R/powerConLogistic.R
Sample Size Calculation for Conditional Logistic Regression with Continuous Covariate, such as matched logistic regression or nested case-control study.
1 2 3 4 5 6 7 8 9 10 11 12 13 | powerConLogistic.con(
N = NULL,
power = 0.8,
OR,
sigma,
nD,
nH,
R2 = 0,
alpha = 0.05,
nTests = 1,
OR.low = 1.01,
OR.upp = 100
)
|
N |
integer. Number of sets. Each set contains |
power |
numeric. Power of the test for if the exposure variable is associated with the risk of diseases |
OR |
numeric. Odds ratio =exp(θ), where θ is the regression coefficient of the exposure variable. |
sigma |
numeric. Standard deviation of the continuous exposure variable. |
nD |
integer. Number of cases per set. |
nH |
integer. Number of controls per set. |
R2 |
numeric. Coefficient of determination of the exposure variable and other covariates |
alpha |
numeric. family-wise type I error rate. |
nTests |
integer. Number of tests. |
OR.low |
numeric. Lower bound of odds ratio. Only used when |
OR.upp |
numeric. Upper bound of odds ratio. Only used when |
The power and sample size calculation formulas are provided by Lachin (2008, Section 3.1, Formulas (24) and (25))
power = Φ≤ft( √{N c} - z_{α/(2 nTests)}\right)
and
N = (z_{power} + z_{α/(2 nTests)})^2/ c
where Φ is the cumulative distribution function of the standard normal distribution N(0, 1), z_{a} is the upper 100 a-th percentile of N(0, 1),
c = θ^2 σ^2 nD (1-1/b) (1-R^2)
and b is the Binomial coefficient (n chooses nD), n = nD + nH, and R^2 is the coefficient of determination for linear regression linking the exposure with other covariates.
If the inputs is.null(N) = TRUE
and is.null(power) = FALSE
,
then the function returns the number N
of sets.
If the inputs is.null(N) = FALSE
and is.null(power) = TRUE
,
then the function returns the power.
Otherwise, an error message is output.
Lachin, JM Sample Size Evaluation for a Multiply Matched Case-Control Study Using the Score Test From a Conditional Logistic (Discrete Cox PH) Regression Model. Stat Med. 2008 27(14): 2509-2523
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | library(pracma)
# Section 4.1 in Lachin (2008)
# estimate number of sets
N = powerConLogistic.con(N = NULL,
power = 0.85,
OR = 1.39,
sigma = 1,
nD = 1,
nH = 2,
R2 = 0,
alpha = 0.05,
nTests = 1)
print(ceiling(N)) # 125
# estimate power
power = powerConLogistic.con(N = 125,
power = NULL,
OR = 1.39,
sigma = 1,
nD = 1,
nH = 2,
R2 = 0,
alpha = 0.05,
nTests = 1)
print(power) # 0.85
# estimate OR
OR = powerConLogistic.con(N = 125,
power = 0.85,
OR = NULL,
sigma = 1,
nD = 1,
nH = 2,
R2 = 0,
alpha = 0.05,
nTests = 1)
print(OR) # 1.39
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.