sampleSizeCont: Sample size calculator for continuous outcomes

Description Usage Arguments Value Examples

View source: R/samplesize.R

Description

Calculates sample size for a trial with a continuous outcome, for a given power and false positive rate.

Usage

1
sampleSizeCont(Dm, SD, a = 0.05, b = 0.2, K = 1)

Arguments

Dm

Anticipated absolute difference in means between the two groups (intervention and control).

SD

Anticipated standard deviation for the outcome.

a

False positive rate (alpha). Defaults to 0.05 (5%).

b

False negative rate (beta). Defaults to 0.2. Power is one minus beta; thus the default is 80% power.

K

Ratio of intervention group size to control group size. Defaults to 1, meaning both groups have the same size. Set to infinity (Inf) in order to calculate sample size for a single-group study, see details below.

Value

An integer vector of length 2, with the sample sizes for the control and intervention groups.

If K=Inf, then the sample size calculation is not for a study with two groups, but for a single-group study in which we try to show a difference from a fixed known population mean. In that case, argument Dm represents the absolute difference between the study mean and population mean, rather than the difference in means between two groups. And the return value is a single value, i.e. the sample size of the study.

Examples

1
2
3
4
5
6
7
8
# Sample size for a trial with 2:1 randomization, aiming to show a mean
# difference of 2 for a continuous outcome with a standard deviation of 3, 
# with 90\% power.
sampleSizeCont(2, 3, b=0.1, K=2)

# Similar for a single-group study aiming to show a difference of 2 against
# a known population mean. 
sampleSizeCont(2, 3, b=0.1, K=Inf)

miniMeta documentation built on March 1, 2020, 5:07 p.m.