## Summary

The Mediana R package uses a simulation-based method to estimate statistical power in clinical trials. Since the power level is estimate, it is natural to compute a confidence interval around the resulting estimate.

A simple example will be used to illustrate how to compute confidence intervals of this kind. We will consider the case study used in the FAQ page that focused on the calculation the required sample size in a trial. Please refer to the case study before reading the rest of this section.

## Simulation results

To facilitate the review of simulation results produced by the CSE function in this case study, the estimated power values are presented in the following table.

Sample size scenario Sample size per arm Marginal power (%)
1 55 84.7
2 60 87.7
3 65 90.0
4 70 92.1
5 75 93.7

## Confidence intervals

The results presented above were generated using 10,000 simulation runs. The estimated power is simply the result of estimating a proportion, therefore, the corresponding confidence interval can be derived using the following normal approximation:

where $\hat{p}$ is the estimated power, $z_{\alpha}$ is the $1-\alpha/2$ quantile of the standard normal distribution and $n$ is the number of simulation runs.

The following function can be called to compute a confidence interval for the estimated power from the simulation results returned by the CSE function.

This function requires two arguments, the first one (CSE) is the object generated by the CSE function and the second one (ci) is the level of the confidence interval which must lie between 0 and 1.

It is shown below how to invoke this function to compute a confidence interval for the estimated power in this case study.

A summary of the results is presented below.

Sample size scenario Sample size per arm Marginal power (%) 95% confidence interval (%)
1 55 84.7 [83.95;85.37]
2 60 87.7 [87.09;88.37]
3 65 90.0 [89.47;90.65]
4 70 92.1 [91.52;92.58]
5 75 93.7 [93.18;94.14]