Tutorials › Competing Risks and Multi-State Models › Checking a Gray-Test Power Simulation

Testing and Design · Tutorial 234 of 699

Checking a Gray-Test Power Simulation

A credible power estimate requires more than counting significant tests: check calibration, generated data, and simulation precision.

Advanced 12 min read

What You'll Learn

  • Estimate empirical type I error from simulations generated under the null.
  • Quantify Monte Carlo uncertainty in estimated type I error and power.
  • Audit target-event, competing-event, and censoring proportions by group.
  • Distinguish observed status proportions from cumulative incidence probabilities.
  • Diagnose invalid test runs, coding errors, and poorly represented design assumptions.
  • Decide how many simulation replicates are needed for a desired level of precision.

Why a Power Estimate Needs Checking

A simulation-based power calculation repeatedly generates hypothetical studies under a specified alternative, applies the planned Gray test, and estimates power by the fraction of tests that reject. That fraction is useful only if the simulated studies represent the design and the test behaves appropriately. A coding mistake, unexpected event mix, excessive censoring, or Monte Carlo noise can all produce a convincing-looking but misleading estimate.

The earlier material on Simulation-Based Sample-Size Planning describes the basic planning strategy. Here the emphasis is on validation: check the test under a null scenario, inspect the simulated outcomes under both null and alternative scenarios, and quantify the random error in the estimated rejection fraction. The Gray test compares cumulative incidence functions for a specified cause while accounting for competing events; the checks below do not replace that test or its assumptions.

Definition: For \(B\) independently simulated studies, let \(R_b=1\) if the planned test rejects in replicate \(b\), and \(R_b=0\) otherwise. The empirical rejection rate is \(\hat{q}=B^{-1}\sum_{b=1}^B R_b\). Under a null-generating scenario, \(\hat{q}\) estimates the type I error rate; under an alternative-generating scenario, it estimates power. These are separate quantities and require separate simulation scenarios.

Check Calibration Under the Null

Before trusting estimated power, simulate studies under a null hypothesis that satisfies the test’s null condition: the target-cause cumulative incidence functions are equal across the groups being compared. For each replicate, generate the full competing-risks data, apply the planned Gray test to the planned target cause and groups, and record whether its p-value is below the prespecified significance level \(\alpha\). The empirical rejection rate estimates the test’s type I error under that particular null-generating scenario.

A valid check must reproduce the analysis as it will be used: the sample sizes, allocation, follow-up, censoring, event definitions, strata if applicable, test implementation, and rejection threshold. The simulation mechanism should also satisfy the assumptions needed for the planned analysis. In particular, right censoring should be independent of the event process under the assumed model, at least conditional on the variables represented in the analysis. If censoring depends on unmodelled prognosis, a high or low rejection rate may reflect a mismatch between the data-generating process and the test, not merely a test-programming defect.

The nominal level is a long-run rate, not a promise that one finite simulation will reject exactly \(\alpha B\) times. Compare the observed rate with its Monte Carlo uncertainty. Also examine more than one plausible null scenario when important features vary—for example, if the competing-event process or censoring differs between groups. Equal target-cause cumulative incidence is the null being checked; it does not require every other aspect of the groups’ event processes to be identical.

Worked Example: Interpreting a Null Rejection Rate

A hypothetical validation run uses \(B=2{,}000\) independently generated null studies and a two-sided Gray test with \(\alpha=0.05\). The test rejects in 112 studies. The simulated null construction sets the target-cause cumulative incidence equal between groups, and the implementation uses the planned sample sizes, follow-up, and censoring.

The estimated type I error is

$$ \hat{q}=\frac{112}{2{,}000}=0.056. $$

The estimated Monte Carlo standard error is

$$ SE_{\mathrm{MC}}=\sqrt{\frac{\hat{q}(1-\hat{q})}{B}} =\sqrt{\frac{0.056(0.944)}{2{,}000}} \approx 0.00514. $$

A rough 95% normal interval for the simulated rejection probability is \(0.056\pm1.96(0.00514)\), or approximately \(0.0459\) to \(0.0661\). The nominal rate \(0.05\) lies within this interval, so these results do not show a clear calibration problem. They also do not prove that the test is calibrated in every setting: the interval reflects simulation error for this specific null scenario, not uncertainty about all possible models.

Audit Events and Censoring

The rejection fraction is not enough. For each simulated scenario, summarize the numbers and proportions of target-cause events, competing events, and censored observations, separately by group. Check that these quantities are plausible under the design inputs and consistent with the simulation code. When the data-generating model provides known cumulative incidence probabilities at the study horizon, compare the generated outcomes with those probabilities across many replicates, allowing for sampling variation.

A single replicate’s fraction with a target event before censoring is not generally the target-cause cumulative incidence. Participants censored before the horizon have unknown later event status; the observed event fraction therefore depends on censoring as well as the event process. Use the simulation model’s known cumulative incidence as a reference when available, and use averages across replicates to diagnose systematic discrepancies. For censoring, distinguish administrative censoring at the planned end of follow-up from loss to follow-up, and check censoring times as well as final status counts. Similar overall censoring percentages can conceal very different timing patterns or group-specific censoring.

There is no universal event proportion that guarantees adequate power. The relevant question is whether the generated numbers agree with the assumed design and whether the study produces enough information for the planned comparison. A large competing-event burden can reduce opportunities to observe the target event. Very few target events, heavy early censoring, or pronounced discrepancies between groups and their inputs warrant investigation before interpreting power.

Worked Example: Checking Outcome Proportions by Group

In one hypothetical replicate, each of two groups has 500 participants followed for at most two years. At the horizon, group A has 70 recorded target events, 40 recorded competing events, and 390 censored participants. Group B has 90 recorded target events, 35 competing events, and 375 censored participants. The categories exhaust each group: \(70+40+390=500\) and \(90+35+375=500\).

The observed proportions are:

$$ \begin{array}{c|ccc} &\text{Target event}&\text{Competing event}&\text{Censored}\\ \text{Group A}&70/500=0.140&40/500=0.080&390/500=0.780\\ \text{Group B}&90/500=0.180&35/500=0.070&375/500=0.750 \end{array} $$

These numbers are a useful audit, not an estimate of the true cumulative incidence without further adjustment. The target-event proportions are observed event fractions; censoring may prevent some participants’ event status by two years from being known. The counts are internally consistent, but the analyst should compare them with the simulation’s expected event and censoring patterns across many replicates, and inspect event and censoring times. If the code was intended to produce substantially more target events or less censoring, the discrepancy calls for debugging or a revised design interpretation. This one replicate alone is not evidence that the power calculation is wrong.

Quantify Monte Carlo Uncertainty

For independent replicates under a fixed scenario, each \(R_b\) is a Bernoulli random variable with rejection probability \(q\). Thus \(\operatorname{Var}(R_b)=q(1-q)\). Since \(\hat{q}\) is the average of \(B\) independent indicators,

$$ \operatorname{Var}(\hat{q}) =\operatorname{Var}\left(\frac{1}{B}\sum_{b=1}^{B}R_b\right) =\frac{1}{B^2}\sum_{b=1}^{B}q(1-q) =\frac{q(1-q)}{B}. $$

Replacing the unknown \(q\) by \(\hat{q}\) gives the Monte Carlo standard error \(SE_{\mathrm{MC}}=\sqrt{\hat{q}(1-\hat{q})/B}\). This measures simulation noise in the estimated rejection probability; it is not the standard error of the Gray test statistic within a study. For a rough large-\(B\) interval, use \(\hat{q}\pm1.96SE_{\mathrm{MC}}\). A Wilson or exact binomial interval is preferable when the number of replicates is small or the rejection rate is near zero or one.

The same calculation applies to an estimated power, replacing \(q\) with the alternative-scenario rejection probability. Choose \(B\) to achieve useful precision, rather than relying on a customary replicate count. Because \(q(1-q)\leq0.25\), a conservative approximate requirement for Monte Carlo standard error no greater than \(d\) is \(B\geq0.25/d^2\). For example, targeting \(d=0.01\) gives \(B\geq2{,}500\) as a conservative planning value; a tighter interval-width target may require more replicates.

Worked Example: Reporting Simulated Power With Precision

A hypothetical alternative scenario is evaluated using \(B=1{,}000\) independently generated studies. The planned Gray test rejects in 780 studies. Assume all 1,000 runs completed successfully and the event and censoring audits agree with the intended design.

The estimated power and its Monte Carlo standard error are

$$ \hat{q}=\frac{780}{1{,}000}=0.780,\qquad SE_{\mathrm{MC}}=\sqrt{\frac{0.780(1-0.780)}{1{,}000}} =\sqrt{0.0001716}\approx0.0131. $$

The rough 95% Monte Carlo interval is \(0.780\pm1.96(0.0131)\), or about \(0.754\) to \(0.806\). A suitable report is: “Estimated power was 78.0%, with approximate 95% Monte Carlo limits of 75.4% to 80.6%.” These limits describe simulation uncertainty around the rejection probability under the specified alternative and design. They are not a confidence interval for a treatment effect, and they do not account for uncertainty in the assumptions used to specify the alternative.

A Practical Validation Sequence

A disciplined check separates problems in the simulation from uncertainty in the final estimate. The following sequence is useful before reporting a power result.

1
Verify the scenario and analysis.
Confirm the target cause, groups, null or alternative, significance level, allocation, follow-up, censoring rules, and Gray-test implementation. Check that the test is applied to the intended data and that the p-value rule is exactly \(p<\alpha\).
2
Run null simulations.
Set equal target-cause cumulative incidence functions, run the complete analysis, and compare the empirical rejection rate with \(\alpha\) using its Monte Carlo uncertainty. Investigate clear excess rejection or strong conservatism.
3
Audit generated records.
Check group sizes, event coding, target and competing event counts, censoring counts and times, follow-up limits, and any strata. Reconcile the summaries with the model inputs and known simulated probabilities.
4
Estimate alternative power and precision.
Only after those checks, calculate the rejection fraction under the alternative and report its Monte Carlo standard error or interval, alongside the number of completed replicates.

Simulation errors can also appear as impossible statuses, event times after administrative follow-up, or a mismatch between intended and actual group sizes. Do not silently drop failed test runs: report how many failed, determine why, and correct the process or define a principled handling rule before estimating power. A large number of failures can make the completed-run rejection fraction unrepresentative.

How This Check Differs From Other Design Approaches

An approximate sample-size calculation is faster and can clarify how event rates, allocation, and effect size affect a design. It relies on its approximation and input assumptions. Simulation can represent specified competing-event and censoring mechanisms more directly, but it is only as credible as its code and data-generating assumptions. It also adds Monte Carlo error, which must be reported or made small enough for the decision at hand.

Likewise, comparing the empirical null rejection rate with \(\alpha\) is a diagnostic, not a substitute for checking the model. A rate near \(\alpha\) does not establish that the simulation has the right event mix, nor does it validate an alternative scenario. Conversely, a modest difference from \(\alpha\) may be ordinary Monte Carlo variation. Interpret rejection rates together with outcome audits, test-failure counts, and uncertainty intervals.

Common Pitfall

Wrong reasoning: “The null simulation rejected in 6% of 1,000 runs instead of 5%, so the test is invalid and the power estimate is unusable.” The estimate is \(0.060\), and its Monte Carlo standard error is \(\sqrt{0.06(0.94)/1{,}000}\approx0.00751\). A rough 95% interval is approximately \(0.0453\) to \(0.0747\), which includes \(0.05\). The observed difference alone is not strong evidence of a calibration failure.

Correction: Assess the discrepancy relative to simulation uncertainty, then check the null construction, event and censoring patterns, code, and test runs. Increase \(B\) if more precise calibration evidence is needed. Do not treat a nonsignificant calibration discrepancy as proof of validity, and do not treat every finite-simulation difference from \(\alpha\) as a defect.

Key takeaway: A power simulation is credible only when the null rejection rate is reasonably calibrated, generated event and censoring patterns match the design assumptions, and Monte Carlo uncertainty is small enough to support the intended conclusion.

Check Your Understanding

Answer each question, then compare with the brief solutions.

  1. In 4,000 null replicates, 236 tests reject at \(\alpha=0.05\). Estimate the type I error and its Monte Carlo standard error. Is this by itself a clear calibration failure?
  2. Why is the fraction with an observed target-cause event by the study horizon not generally equal to the target-cause cumulative incidence?
  3. A power simulation estimates \(\hat{q}=0.64\) from \(B=1{,}600\) replicates. Calculate the Monte Carlo standard error.
  4. What should be checked if a simulated group has many more censored records than intended?
  5. Does a null rejection rate close to \(\alpha\) validate the alternative scenario’s event proportions? Explain.

Solutions. (1) \(\hat{q}=236/4{,}000=0.0590\); \(SE_{\mathrm{MC}}=\sqrt{0.059(0.941)/4{,}000}\approx0.00373\). The rough 95% interval is \(0.0517\) to \(0.0663\), so this run suggests possible excess rejection rather than providing conclusive evidence; inspect the setup and, if needed, increase \(B\). (2) Censoring before the horizon leaves later event status unknown, so the observed event fraction depends on censoring as well as event incidence. (3) \(\sqrt{0.64(0.36)/1{,}600}=0.0120\). (4) Check the censoring distribution and timing, follow-up limits, group-specific inputs, and status coding against the intended design. (5) No. Calibration under the null and event-pattern checks under the alternative are distinct diagnostics; each scenario needs its own audit.

Clinical Biostats