sampleSize_continuous {samplesizelogisticcasecontrol} | R Documentation |
Sample size for a continuous exposure
Description
Calculates the required sample size of as case-control study with a continuous exposure variable
Usage
sampleSize_continuous(prev, logOR, distF=NULL, distF.support=c(-Inf, Inf),
data=NULL, size.2sided=0.05, power=0.9, cc.ratio=0.5, interval=c(-100, 100),
tol=0.0001, n.samples=10000, distF.var=NULL)
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 |
distF |
NULL, a function or a character string giving the pdf of the exposure variable for the case
of no confounders, or giving the function to generate random vectors from the
distribution formed by the confounders and exposure.
For the case of no confounders, examples are |
distF.support |
Two element vector giving the domain of |
data |
NULL, matrix, data frame or a list of type |
size.2sided |
Number between 0 and 1 giving the size of the 2-sided hypothesis test. The default is 0.05. |
power |
Number between 0 and 1 for the desired power of the test. The default is 0.9. |
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. |
n.samples |
Integer giving the number of random vectors to generate when the option |
distF.var |
The variance of the exposure variable for the case of no confounders. This option is for efficiency purposes. If not specified, the variance will be estimated by either the empirical variance of a random sample from the distribution of the exposure or by numerical integration. The default is NULL. |
Details
The data
option takes precedance over the other options. If data
is not specified,
then the distribution of the exposure will be N(0,1) or MVN(0, 1) depending on whether there
are confounders.
Value
A list containing four sample sizes, where two of them are for a Wald test and two for a score test.
The two sample sizes for each test correspond to the equations for
n_{1}
and n_{2}
.
See Also
sampleSize_binary
, sampleSize_ordinal
, sampleSize_data
Examples
prev <- 0.01
logOR <- 0.3
# No confounders, exposure assumed to be N(0,1)
sampleSize_continuous(prev, logOR)
# Two confounders and exposure assumed to be MVN(0,1)
beta <- c(0.1, 0.1, logOR)
sampleSize_continuous(prev, beta)
# No confounders, exposure is beta(0.3, 3)
sampleSize_continuous(prev, logOR, distF="dbeta(m, shape1=0.3, shape2=3)",
distF.support=c(0, 1))