Documentation

Test 1 Mean

Compare 2 Means

Compare k Means

Test 1 Proportion

Compare 2 Proportions

Compare Paired Proportions

Compare k Proportions

Test Time-To-Event Data

Test Odds Ratio

Test Relative Incidence in Self Controlled Case Series Studies

You can use this calculator to perform power and sample size calculations for a time-to-event analysis, sometimes called survival analysis. A two-group time-to-event analysis involves comparing the time it takes for a certain event to occur between two groups.

For example, we may be interested in whether there is a difference in recovery time following two different medical treatments. Or, in a marketing analysis we may be interested in whether there is a difference between two marketing campaigns with regards to the time between impression and action, where the action may be, for example, buying a product.

Since 'time-to-event' methods were originally developed as 'survival' methods, the primary parameter of interest is called the hazard ratio.
The *hazard* is the probability of the event occurring in the next instant given that it hasn't yet occurred.
The *hazard ratio* is then the ratio of the hazards between two groups
Letting $\theta$ represent the hazard ratio, the hypotheses of interest are

$H_1:|\ln(\theta)|\lt \delta$

where $\delta$ is the equivalence margin, just like in the other equivalence calculators here. The calculator above and the formulas below use the notation that

$\theta$ | is the hazard ratio |

$\ln(\theta)$ | is the natural logarithm of the hazard ratio, or the log-hazard ratio |

$p_E$ | is the overall probability of the event occurring within the study period |

$p_A$ and $p_B$ | are the proportions of the sample size allotted to the two groups, named 'A' and 'B' |

$n$ | is the total sample size |

This calculator uses the following formulas to compute sample size and power, respectively:
$$n=\frac{1}{p_A\;p_B\;p_E}\left(\frac{z_{1-\alpha}+z_{1-\beta/2}}{\delta-|\ln(\theta)|}\right)^2$$

$$1-\beta= 2\Phi\left( z-z_{1-\alpha}\right)-1 \quad
,\quad z=\left(\delta-|\ln(\theta)|\right)\sqrt{n\;p_A\;p_B\;p_E}$$
where

- $n$ is sample size
- $\Phi$ is the standard Normal distribution function
- $\Phi^{-1}$ is the standard Normal quantile function
- $\alpha$ is Type I error
- $\beta$ is Type II error, meaning $1-\beta$ is power
- $\delta$ is the testing margin

R code to implement these functions:

hr=1 delta=0.5 pE=0.8 pA=0.5 alpha=0.05 beta=0.20 (n=((qnorm(1-alpha)+qnorm(1-beta/2))/(delta-abs(log(hr))))^2/(pA*(1-pA)*pE)) ceiling(n) # 172 (Power=2*pnorm((delta-abs(log(hr)))*sqrt(n*pA*(1-pA)*pE)-qnorm(1-alpha))-1)

Chow S, Shao J, Wang H. 2008.Sample Size Calculations in Clinical Research. 2nd Ed. Chapman & Hall/CRC Biostatistics Series.page 177.

comments powered by Disqus