power_data: Power using pilot data

View source: R/power_common.R

power_dataR Documentation

Power using pilot data

Description

Calculates the power of a case-control study with pilot data

Usage

power_data(prev, logOR, data, size.2sided=0.05, sampleSize=1000, cc.ratio=0.5,
        interval=c(-100, 100), tol=0.0001) 

Arguments

prev

Number between 0 and 1 giving the prevalence of disease. No default.

logOR

Vector of ordered log-odds ratios for the confounders and exposure. The last log-odds ratio in the vector is for the exposure. If the option data (below) is specified, then the order must match the order of data. No default.

data

Matrix, data frame or a list of type file.list that gives a sample from the distribution of the confounders and exposure (see details). If a matrix or data frame, then the last column consists of random values for the exposure, while the other columns are for the confounders. The order of the columns must match the order of the vector logOR. The default is NULL.

size.2sided

Number between 0 and 1 giving the size of the 2-sided hypothesis test. The default is 0.05.

sampleSize

Sample size of the study (see details). The default is 1000.

cc.ratio

Number between 0 and 1 for the proportion of cases in the case-control sample. The default is 0.5.

interval

Two element vector giving the interval to search for the estimated intercept parameter. The default is c(-100, 100).

tol

Positive value giving the stopping tolerance for the root finding method to estimate the intercept parameter. The default is 0.0001.

Details

The option sampleSize is not necessarily nrow(data). The input data can be a small sample of pilot data that would be representative of the actual study data.

Value

A list containing four powers, where two of them are for a Wald test and two for a score test. The two powers for each test correspond to the equations for n_{1} and n_{2}.

See Also

power_binary, power_ordinal, power_continuous

Examples

  prev  <- 0.01
  logOR <- 0.3
  data  <- matrix(rnorm(100, mean=1.5), ncol=1)

  # Assuming exposuure is N(1.5, 1)
  power_data(prev, logOR, data) 


samplesizelogisticcasecontrol documentation built on Aug. 21, 2023, 5:07 p.m.