Power estimation via simulation is a binomial proportion problem.
The posterior predictive interval answers: "If I run a new simulation study with \(m\) simulations, what range of power estimates might I observe?"
Let \(\pi\) denote the hypothetical true power value, \(\hat{\pi} = x/n\) denote the hypothetical observed power value, \(n\) denote the number of simulations, and \(x = \text{round}(\hat{\pi} \cdot n)\) denote the number of rejections.
With a \(\text{Beta}(\alpha, \beta)\) prior on the true power \(\pi\), the posterior after observing \(x\) successes in \(n\) trials is:
$$
\pi \mid X = x \sim \text{Beta}(\alpha + x, \beta + n - x).
$$
The posterior predictive distribution for \(Y\), the number of successes in a future study with \(m\) trials, is Beta-Binomial:
$$
Y \mid X = x \sim \text{BetaBinomial}(m, \alpha + x, \beta + n - x).
$$
The posterior predictive interval is constructed from quantiles of this distribution, expressed as proportions \(Y/m\).
The posterior predictive mean and variance of \(\hat{\pi}_{\text{new}} = Y/m\) are:
$$
\begin{aligned}
E[\hat{\pi}_{\text{new}} \mid X = x] &= \frac{\alpha + x}{\alpha + \beta + n} \\
\text{Var}[\hat{\pi}_{\text{new}} \mid X = x]
&= \frac
{(\alpha + x)(\beta + n - x)(\alpha + \beta + n + m)}
{m (\alpha + \beta + n)^{2} (\alpha + \beta + n + 1)}.
\end{aligned}
$$
Argument future_nsims
The argument future_nsims allows you to estimate prediction interval bounds for a hypothetical future study with different number of simulations.
Note that a small initial number for nsims results in substantial uncertainty about the true power.
A correspondingly large number of future simulations future_nsims will more precisely estimate the true power, but the past large uncertainty is still carried forward.
Therefore you still need an adequate number of simulations nsims in the original study, not just more in the replication future_nsims, to ensure narrow prediction intervals.
Approximate parametric tests
When power is computed using approximate parametric tests (see simulated()), the power estimate and confidence/prediction intervals apply to the Monte Carlo test power \(\mu_K = P(\hat{p} \leq \alpha)\) rather than the exact test power \(\pi = P(p \leq \alpha)\).
These quantities converge as the number of datasets simulated under the null hypothesis \(K\) increases.
The minimum observable p-value is \(1/(K+1)\), so \(K > 1/\alpha - 1\) is required to observe any rejections.
For practical accuracy, we recommend choosing \(\text{max}(5000, K \gg 1/\alpha - 1)\) for most scenarios.
For example, if \(\alpha = 0.05\), use simulated(nsims = 5000).