Description Usage Arguments Value Note Author(s) References Examples
Calculating power/sample size for simple logistic regression with a binary predictor. The function solves for one of the following: alpha, power, OR, N.
1 2 |
alpha |
type I error rate. Can range from 0 to 1 (typically 0.05) |
power |
1 - Pr(type II error) Can range from 0 to 1 (typically 0.80) |
P0 |
baseline probability that Y=1 |
OR |
odds ratio (odds(Y=1|X=1) / odds(Y=1|X=0)) |
R |
proportion of sample (N) with X1=1 |
N |
sample size |
Return one of the following parameters
alpha
, power
, OR
, N
The test is a two-sided test. For one-sided tests, double the significance level. For example, you can set alpha=0.10 to obtain one-sided test at 0.05 significance level.
alpha
, power
, P0
, OR
, N
can be input as either single values or vectors. Only one parameter can be input as a vector.
David Aaby <david.aaby@northwestern.edu>
Hsieh, F.Y., Block, D.A., and Larsen, M.D. 1998. A Simple Method of Sample Size Calculation for Linear and Logistic Regression, Statistics in Medicine, Volume 17, pages 1623-1634.
1 2 3 4 5 | Logpower.bin(alpha=0.05, power=.90, P0=0.07, OR=1.5, R=.50) #outputs N
Logpower.bin(alpha=0.05, power=.90, P0=0.07, OR=c(1.5,2.0), R=.50) #outputs a vector of Ns
Logpower.bin(alpha=0.05, power=.90, P0=0.07, R=.50, N=3326) #outputs OR
Logpower.bin(power=.90, P0=0.07, OR=1.5, R=.50, N=3326) #outputs alpha
Logpower.bin(alpha=0.05, P0=0.07, OR=1.5, R=.50, N=3326) #outputs beta
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.