Introduction
The twoCoprimary package provides comprehensive tools
for sample size calculation and power analysis in clinical trials with
two co-primary endpoints. This package implements methodologies from
multiple publications and supports various endpoint types.
What are Co-Primary Endpoints?
In clinical trials, co-primary endpoints are multiple primary endpoints that must all show statistically significant treatment effects for the trial to be considered successful. This is in contrast to multiple primary endpoints where demonstrating an effect on any one endpoint is sufficient.
Statistical Framework
Intersection-Union Test (IUT)
The co-primary endpoint framework is based on the intersection-union test principle. Let and be the test statistics for endpoints 1 and 2, respectively.
Decision rule: Reject if and only if:
where is the -th quantile of the standard normal distribution.
Type I Error Control
The overall Type I error rate is:
Under the intersection-union test, this is automatically controlled at level without adjustment:
This is because rejecting when both statistics exceed the threshold is more conservative than rejecting when either statistic exceeds the threshold.
Overall Power
Under the alternative hypothesis , the overall power is:
When follow a bivariate normal distribution with correlation :
where:
- is the bivariate normal cumulative distribution function with correlation
- and are the non-centrality parameters under
Impact of Correlation
The correlation between test statistics affects the overall power:
- Positive correlation (): Increases power and reduces required sample size
- Zero correlation (): Test statistics are independent
- Negative correlation (): Decreases power and increases required sample size
Key insight: Accounting for positive correlation between endpoints can lead to substantial sample size reductions (typically 5-15% for -0.8) compared to assuming independence.
Supported Endpoint Types
The package supports five combinations of co-primary endpoints:
1. Two Continuous Endpoints
Use case: Trials measuring two continuous outcomes (e.g., systolic and diastolic blood pressure)
Statistical model: Both endpoints follow normal distributions
Key functions:
-
ss2Continuous(): Sample size calculation -
power2Continuous(): Power calculation -
twoCoprimary2Continuous(): Unified interface for both
Reference: Sozu et al. (2011)
# Example: Two continuous endpoints with correlation rho = 0.5
ss2Continuous(
delta1 = 0.5, # Standardized effect size for endpoint 1
delta2 = 0.5, # Standardized effect size for endpoint 2
sd1 = 1, # Standard deviation for endpoint 1
sd2 = 1, # Standard deviation for endpoint 2
rho = 0.5, # Correlation between endpoints
r = 1, # Balanced allocation
alpha = 0.025,
beta = 0.2,
known_var = TRUE
)
#>
#> Sample size calculation for two continuous co-primary endpoints
#>
#> n1 = 79
#> n2 = 79
#> N = 158
#> delta = 0.5, 0.5
#> sd = 1, 1
#> rho = 0.5
#> allocation = 1
#> alpha = 0.025
#> beta = 0.2
#> known_var = TRUE2. Two Binary Endpoints (Asymptotic Approximation)
Use case: Trials with two binary outcomes using normal approximation (large sample)
Statistical model: Binary endpoints with asymptotic normal approximation
Key functions:
-
ss2BinaryApprox(): Sample size calculation -
power2BinaryApprox(): Power calculation -
twoCoprimary2BinaryApprox(): Unified interface for both
Reference: Sozu et al. (2010)
Supported test methods:
- AN: Asymptotic normal test without continuity correction
- ANc: Asymptotic normal test with continuity correction
- AS: Arcsine transformation without continuity correction
- ASc: Arcsine transformation with continuity correction
When to use: Large sample sizes (typically ) and probabilities not too extreme ()
# Example: Two binary endpoints
ss2BinaryApprox(
p11 = 0.7, p12 = 0.6, # Endpoint 1 and 2 in treatment group
p21 = 0.4, p22 = 0.3, # Endpoint 1 and 2 in control group
rho1 = 0.5, # Correlation in treatment group
rho2 = 0.5, # Correlation in control group
r = 1, # Balanced allocation
alpha = 0.025,
beta = 0.2,
Test = "AN"
)
#>
#> Sample size calculation for two binary co-primary endpoints
#>
#> n1 = 52
#> n2 = 52
#> N = 104
#> p (group 1) = 0.7, 0.6
#> p (group 2) = 0.4, 0.3
#> rho = 0.5, 0.5
#> allocation = 1
#> alpha = 0.025
#> beta = 0.2
#> Test = AN3. Two Binary Endpoints (Exact Methods)
Use case: Small to medium sample sizes requiring exact inference
Statistical model: Binary endpoints with exact tests
Key functions:
-
ss2BinaryExact(): Sample size calculation using exact tests -
power2BinaryExact(): Exact power calculation -
twoCoprimary2BinaryExact(): Unified interface for both
Reference: Homma and Yoshida (2025)
Supported tests:
- Chisq: Chi-squared test
- Fisher: Fisher’s exact test (conditional test)
- Fisher-midP: Fisher’s mid-p test
- Z-pool: Z-pooled exact unconditional test
- Boschloo: Boschloo’s exact unconditional test
When to use: Small/medium samples (), extreme probabilities ( or ), or when strict Type I error control is required
# Example: Exact methods for small samples
ss2BinaryExact(
p11 = 0.7, p12 = 0.6,
p21 = 0.4, p22 = 0.3,
rho1 = 0.5, rho2 = 0.5,
r = 1,
alpha = 0.025,
beta = 0.2,
Test = "Fisher" # or "Chisq", "Fisher-midP", "Z-pool", "Boschloo"
)
#>
#> Sample size calculation for two binary co-primary endpoints
#>
#> n1 = 59
#> n2 = 59
#> N = 118
#> p (group 1) = 0.7, 0.6
#> p (group 2) = 0.4, 0.3
#> rho = 0.5, 0.5
#> allocation = 1
#> alpha = 0.025
#> beta = 0.2
#> Test = Fisher4. Mixed Continuous and Binary Endpoints
Use case: Trials with one continuous and one binary outcome
Statistical model: Normal distribution for continuous endpoint, Bernoulli for binary endpoint, with biserial correlation
Key functions:
-
ss2MixedContinuousBinary(): Sample size calculation -
power2MixedContinuousBinary(): Power calculation -
twoCoprimary2MixedContinuousBinary(): Unified interface for both
Reference: Sozu et al. (2012)
Supported test methods for binary endpoint:
- AN: Asymptotic normal test without continuity correction
- ANc: Asymptotic normal test with continuity correction
- AS: Arcsine transformation without continuity correction
- ASc: Arcsine transformation with continuity correction
- Fisher: Fisher’s exact test (simulation-based)
Correlation structure: Uses biserial correlation between observed continuous variable and latent continuous variable underlying the binary outcome
# Example: Continuous + Binary endpoints
ss2MixedContinuousBinary(
delta = 0.5, # Effect size for continuous endpoint
sd = 1, # Standard deviation
p1 = 0.7, # Success probability in treatment group
p2 = 0.4, # Success probability in control group
rho = 0.5, # Biserial correlation
r = 1,
alpha = 0.025,
beta = 0.2,
Test = "AN"
)
#>
#> Sample size calculation for mixed continuous and binary co-primary endpoints
#>
#> n1 = 68
#> n2 = 68
#> N = 136
#> delta = 0.5
#> sd = 1
#> p = 0.7, 0.4
#> rho = 0.5
#> allocation = 1
#> alpha = 0.025
#> beta = 0.2
#> Test = AN5. Mixed Count and Continuous Endpoints
Use case: Trials with overdispersed count data (e.g., exacerbations) and continuous outcomes (e.g., lung function)
Statistical model: Negative binomial distribution for count endpoint, normal distribution for continuous endpoint
Key functions:
-
ss2MixedCountContinuous(): Sample size calculation -
power2MixedCountContinuous(): Power calculation -
twoCoprimary2MixedCountContinuous(): Unified interface for both -
corrbound2MixedCountContinuous(): Calculate valid correlation bounds
Reference: Homma and Yoshida (2024)
Special considerations:
- The negative binomial distribution accommodates overdispersion (variance mean) common in count data
-
Treatment effects must be in the negative direction for both
endpoints: Lower event rate (count endpoint) and lower/better
continuous values indicate treatment benefit. For example, reduction in
exacerbation rate (
r1 < r2) and improvement in lung function (e.g.,mu1 < mu2when lower is better, or larger negative change from baseline)
# Example: Count (exacerbations) + Continuous (FEV1)
ss2MixedCountContinuous(
r1 = 1.0, r2 = 1.25, # Count rates (events per unit time)
nu = 0.8, # Dispersion parameter
t = 1, # Follow-up time
mu1 = -50, mu2 = 0, # Continuous means
sd = 250, # Standard deviation
rho1 = 0.5, rho2 = 0.5, # Correlations
r = 1,
alpha = 0.025,
beta = 0.2
)
#>
#> Sample size calculation for mixed count and continuous co-primary endpoints
#>
#> n1 = 705
#> n2 = 705
#> N = 1410
#> sd = 250
#> rate = 1, 1.25
#> nu = 0.8
#> t = 1
#> mu = -50, 0
#> rho = 0.5, 0.5
#> allocation = 1
#> alpha = 0.025
#> beta = 0.2Impact of Correlation
A key advantage of accounting for correlation between co-primary endpoints is the potential for sample size reduction.
The table below illustrates this for two continuous endpoints:
# Sample size at different correlation levels
correlations <- c(0, 0.3, 0.5, 0.8)
results <- sapply(correlations, function(rho) {
ss2Continuous(
delta1 = 0.5, delta2 = 0.5,
sd1 = 1, sd2 = 1,
rho = rho, r = 1,
alpha = 0.025, beta = 0.2,
known_var = TRUE
)$N
})
data.frame(
Correlation = correlations,
Total_N = results,
Reduction = paste0(round((1 - results/results[1]) * 100, 1), "%")
)
#> Correlation Total_N Reduction
#> 1 0.0 166 0%
#> 2 0.3 162 2.4%
#> 3 0.5 158 4.8%
#> 4 0.8 148 10.8%As correlation increases, the required sample size decreases. At , approximately 11% reduction in sample size can be achieved compared to .
Why Does Correlation Matter?
The correlation between endpoints affects the joint distribution of test statistics. When endpoints are positively correlated:
- Test statistics tend to move together: If is large, is also likely to be large
- Higher probability of rejecting both nulls: increases with
- Sample size reduction: Fewer subjects needed to achieve target power
Mathematically, for bivariate normal with correlation :
when and both endpoints have positive treatment effects.
Choosing the Right Method
| Endpoint Types | Sample Size | Method | Key Considerations |
|---|---|---|---|
| Both continuous | Any | Asymptotic | Simple, well-established |
| Both binary | Large () | Asymptotic | Fast computation, probabilities moderate |
| Both binary | Small/Medium | Exact | Better Type I error control, exact inference |
| 1 Continuous + 1 Binary | Any | Asymptotic | Handles mixed types, biserial correlation |
| 1 Count + 1 Continuous | Any | Asymptotic | Accounts for overdispersion |
Decision Guidelines
For binary endpoints:
- Use asymptotic methods when: , , computational efficiency important
- Use exact methods when: , extreme probabilities ( or ), regulatory requirements for exact tests
For mixed endpoint types:
- Ensure correlation structure is appropriate (e.g., biserial for continuous-binary)
- Consider clinical plausibility of correlation magnitude
- Use conservative estimates if correlation is uncertain
Sample Size Calculation Approach
All methods in this package follow a similar computational approach:
- Specify design parameters: Effect sizes, probabilities, standard deviations, etc.
- Specify correlation: Between endpoints
- Specify error rates: Type I error (typically 0.025 for one-sided) and Type II error (typically 0.2 for 80% power)
- Calculate sample size: Using iterative algorithms
- Verify power: Confirm that calculated sample size achieves target power
Detailed Vignettes
For detailed methodology, examples, and validation against published results, please see:
-
vignette("two-continuous-endpoints"): Two continuous endpoints -
vignette("two-binary-endpoints-approx"): Two binary endpoints (asymptotic) -
vignette("two-binary-endpoints-exact"): Two binary endpoints (exact) -
vignette("mixed-continuous-binary"): Mixed continuous and binary -
vignette("mixed-count-continuous"): Mixed count and continuous
References
Homma, G., & Yoshida, T. (2024). Sample size calculation in clinical trials with two co-primary endpoints including overdispersed count and continuous outcomes. Pharmaceutical Statistics, 23(1), 46-59.
Homma, G., & Yoshida, T. (2025). Exact power and sample size in clinical trials with two co-primary binary endpoints. Statistical Methods in Medical Research, 34(1), 1-19.
Sozu, T., Sugimoto, T., & Hamasaki, T. (2010). Sample size determination in clinical trials with multiple co-primary binary endpoints. Statistics in Medicine, 29(21), 2169-2179.
Sozu, T., Sugimoto, T., & Hamasaki, T. (2011). Sample size determination in superiority clinical trials with multiple co-primary correlated endpoints. Journal of Biopharmaceutical Statistics, 21(4), 650-668.
Sozu, T., Sugimoto, T., & Hamasaki, T. (2012). Sample size determination in clinical trials with multiple co-primary endpoints including mixed continuous and binary variables. Biometrical Journal, 54(5), 716-729.