Logpower.bin: Sample size and power for logistic regression with a binary...

Description Usage Arguments Value Note Author(s) References Examples

Description

Calculating power/sample size for simple logistic regression with a binary predictor. The function solves for one of the following: alpha, power, OR, N.

Usage

1
2
Logpower.bin(alpha = NULL, power = NULL, P0 = NULL, OR = NULL,
  R = NULL, N = NULL)

Arguments

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

Value

Return one of the following parameters

alpha, power, OR, N

Note

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.

Author(s)

David Aaby <david.aaby@northwestern.edu>

References

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.

Examples

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

aabydava/regpoweR documentation built on May 10, 2019, 9:59 a.m.