Learn R Programming

twoCoprimary (version 1.0.0)

ss1Continuous: Sample Size Calculation for a Single Continuous Endpoint

Description

Calculates the required sample size for a two-arm superiority trial with a single continuous endpoint using the standard formula for normally distributed outcomes.

Usage

ss1Continuous(delta, sd, r, alpha, beta)

Value

A data frame with the following columns:

delta

Mean difference (treatment effect)

sd

Common standard deviation

r

Allocation ratio

alpha

One-sided significance level

beta

Type II error rate

n1

Required sample size for group 1

n2

Required sample size for group 2

N

Total sample size (n1 + n2)

Arguments

delta

Mean difference between treatment groups (treatment effect)

sd

Common standard deviation for the continuous endpoint

r

Allocation ratio of group 1 to group 2 (group 1:group 2 = r:1, where r > 0)

alpha

One-sided significance level (typically 0.025 or 0.05)

beta

Target type II error rate (typically 0.1 or 0.2)

Details

The required sample size for group 2 is calculated using the standard formula: $$n_2 = \left\lceil \frac{(1 + 1/r) \sigma^2 (z_\alpha + z_\beta)^2}{\delta^2} \right\rceil$$ where \(z_\alpha\) and \(z_\beta\) are the quantiles of the standard normal distribution corresponding to the one-sided significance level \(\alpha\) and type II error rate \(\beta\), respectively. The sample size for group 1 is \(n_1 = \lceil r \times n_2 \rceil\).

Examples

Run this code
# Balanced design with 1:1 allocation
ss1Continuous(delta = 0.4, sd = 1, r = 1, alpha = 0.025, beta = 0.1)

# Unbalanced design with 2:1 allocation
ss1Continuous(delta = 0.5, sd = 1.2, r = 2, alpha = 0.025, beta = 0.2)

# Large treatment effect
ss1Continuous(delta = 0.8, sd = 1, r = 1, alpha = 0.025, beta = 0.1)

Run the code above in your browser using DataLab