Monte Carlo runs needed for a target standard error of a share of agent-based model runs

For an output that is a share of runs, such as the share in which an outbreak becomes a major one, each run gives a 0 or 1 result and the Monte Carlo standard error of the share is the binomial standard error, the square root of P_exp(1 minus P_exp) over the number of runs, the standard error of an estimated binomial probability in HE-FM-BINOM-004. Putting in the expected share and rearranging gives the number of runs R_prop for a target standard error e_share, equation 1 of Morris and colleagues. The product P_exp(1 minus P_exp) is largest at a share of 0.5, so 0.25 divided by the squared target is a worst-case count when the share is unknown.

Signature

R_prop = P_exp * (1 - P_exp) / e_share^2
Inputs
InputsDefinitionUnit
P_expPlanning value of the share of runs in which the event occurs, above 0 and below 1proportion
e_shareLargest acceptable Monte Carlo standard error of the estimated share, in the same units as P_expproportion
Output
R_propNumber of independent runs whose estimated share has a Monte Carlo standard error equal to the target, before rounding upruns

Function

Agent state update function of an agent-based model

Maps the state of agent i at step t, the set of agents in contact with it, the state of the environment, the intervention in force and a random input to the state of that agent at step t+1, the rule X_i(t+1) = F(X_i(t), N_i(t), E(t), A(t), U_i(t)) of the article. In an infection model the rule for a susceptible agent reduces to a per-step infection probability from its k infectious contacts, the complement of the binomial probability of no events (HE-FM-BINOM-002), followed by a comparison of the agent's own uniform random number with that probability. A per-contact probability built from a transmission rate uses the constant-rate conversion HE-FM-TP-001, and a probability observed over another interval is rescaled with HE-FM-TP-003; neither is restated here. Population outputs are averaged over independent runs, and the Monte Carlo standard error of such a mean is the standard deviation across runs divided by the square root of the number of runs, the form of HE-FM-ANTV-002 with one observation per run and the divisor of HE-FM-BSE-001. This package adds the number of runs needed for a target standard error of a mean and of a share of runs. Attack rates and the final size relation are in HE-FN-ATR-001 and HE-CF-ATR-001, the cohort simulation without interaction is HE-FN-CSIM-001, and expected onward infections and the reproduction number belong to the Basic Reproduction Number page. Notation follows the Agent-Based Model article.

Try this function

Implementations

  • Excel

    Runs needed for a target standard error of a share in Excel

    With the planning share in a cell named ExpectedShare and the target in TargetShareMCSE, CEILING rounds the count up to a whole number of runs, after ROUND to six decimals removes floating-point residue as in HE-IM-ABM-003. The tests below name the result cell RunsForShare.

    =CEILING(ROUND(ExpectedShare*(1-ExpectedShare)/TargetShareMCSE^2,6),1)

Assumptions

  • Expected share set before the agent-based model runs

    P_exp is a planning value from a pilot or an earlier study. When no value is available, 0.5 gives the largest count, since Morris and colleagues note that the worst-case standard error occurs at a share of 50%.

  • Binary run result with independent runs for a share

    Each run either shows the event or does not, and the runs are independent, with seeds set as in HE-AS-ABM-007, so the count of runs with the event is binomial.

Worked examples

  • Morris and colleagues' coverage of 95% with a target standard error of 0.5%

    Morris and colleagues' example of a coverage of 95% estimated with a Monte Carlo standard error of 0.5% needs 1,900 repetitions.

    P_exp = 0.95; e_share = 0.005; R_prop = 1900
  • Worst-case share of 0.5 with a target standard error of 0.005

    At the worst-case share of 0.5 the same target needs 10,000 runs, the figure Morris and colleagues give.

    P_exp = 0.5; e_share = 0.005; R_prop = 10000
  • Illustrative major outbreak share of 0.2 with a target standard error of 0.01

    For an illustrative agent-based model in which about 20% of runs are expected to produce a major outbreak, a standard error of 0.01 for that share needs 1,600 runs.

    P_exp = 0.2; e_share = 0.01; R_prop = 1600

Common errors

  • Share and target standard error in different units

    Entering the target of 0.5% as 0.5 while the share is entered as 0.95 gives 0.19, rounded up to 1 run, instead of 1,900. The share and the target are entered in the same units, both as proportions or both as percentages.

  • Reading the share of first-order runs as the probability of cost-effectiveness

    The share of runs at fixed inputs in which a strategy comes out cost-effective measures chance between simulated histories, first-order uncertainty. The probability that a strategy is cost-effective for a decision comes from draws of uncertain inputs, second-order uncertainty, which Chhatwal and He treat separately under probabilistic sensitivity analysis.

Sources

  • Morris and colleagues equation 1 for the repetitions needed for a share

    Morris TP, White IR, Crowther MJ. Using simulation studies to evaluate statistical methods. Statistics in Medicine. 2019;38(11):2074-2102. Section 5.3, equation 1, which sets the number of repetitions as the expected coverage times one minus the expected coverage divided by the square of the required Monte Carlo standard error, gives 1,900 repetitions for a coverage of 95% with a standard error of 0.5%, and states that the worst case occurs at 50%, where 10,000 repetitions keep the standard error below 0.5%.

    View source →

Canonical Identity

Monte Carlo runs needed for a target standard error of a share of agent-based model runs | HealthEconomics.wiki