Tutorials › Econometrics (Graduate) › Simulation Diagnostics for Estimated Models

Simulation-Based Estimation · Tutorial 909 of 952

Simulation Diagnostics for Estimated Models

Learn a structured set of diagnostics for deciding whether a simulation-based estimate is numerically reliable and what to investigate when it is not.

Advanced 12 min read

What You'll Learn

  • Compare estimates across simulation draw counts without treating stability as proof of accuracy.
  • Use independent replications to quantify simulation variability conditional on the observed data.
  • Check objective values and gradients near a reported solution.
  • Diagnose simulated probabilities that are too small for reliable log-likelihood evaluation.
  • Use effective sample size and maximum normalized weight to flag unstable importance weights.
  • Separate computational diagnostics from sampling uncertainty and identification concerns.

Why Diagnose a Simulation-Based Estimate?

A simulation-based estimator replaces a quantity that is difficult to compute exactly with a numerical approximation. That approximation enters an objective, such as a simulated log likelihood or a simulated-moments criterion, which is then optimized over parameters. The reported estimate can therefore be affected by both the statistical information in the data and the numerical behavior of the simulation and optimization. A successful optimizer termination is not, by itself, evidence that the simulated objective was accurate or that the reported parameter is insensitive to simulation.

Diagnostics ask several distinct questions. Does the estimate change materially when the number of draws increases? Do independent simulation runs produce similar answers? Is the objective stable near the solution, and does the computed gradient agree with a numerical check? Are simulated probabilities or weights being driven by rare draws? These checks do not replace the estimator’s statistical theory. They help identify whether a numerical implementation is behaving plausibly enough for that theory to be relevant.

Definition: Let \(Q_R(\theta)\) denote the implemented simulation-based objective at parameter vector \(\theta\), using \(R\) simulation draws, and let \(\hat{\theta}_R\) denote its optimizer (or the corresponding simulated estimator). A simulation diagnostic is a check of how \(Q_R\), its derivatives, intermediate simulated quantities, or \(\hat{\theta}_R\) behave under controlled changes to the simulation or numerical computation.

The checks below presume that the model, objective, and simulation design have been specified correctly: draws are generated from the intended distribution, the objective uses them as intended, and the optimizer is applied to that objective. A diagnostic can reveal symptoms of an implementation problem, but cannot prove that the model is correctly specified or that the estimator is identified.

Draw-Count Sensitivity

A direct check is to estimate the model with several draw counts, keeping the data, parameterization, optimizer settings, and simulation design comparable. When possible, use nested draws or common random numbers: the smaller draw set is contained in the larger set, or the same underlying random numbers are reused across parameter values and draw-count comparisons. This can make changes easier to interpret by reducing variation attributable solely to unrelated random draws.

Compare the parameter estimates, the objective values evaluated on a common high-accuracy simulation, and quantities of substantive interest. An objective evaluated with different draws at each draw count is not automatically comparable to the same precision: its difference may reflect simulation noise as well as a change in the optimizer’s solution. Also inspect whether parameters move along a weakly identified or nearly flat direction. Small objective changes can accompany noticeable parameter changes in such a direction.

Worked Example: Increasing the Number of Draws

Suppose a hypothetical simulated likelihood model has one parameter \(\theta\), measured in log-odds units. The same hypothetical data and nested simulation draws are used at each draw count. The estimates are:

Draw count \(R\)Estimate \(\hat{\theta}_R\)Objective at the estimate
5000.842-126.41
2,0000.817-126.28
8,0000.811-126.25

From 500 to 2,000 draws, the estimate changes by \(0.817-0.842=-0.025\) log-odds units. From 2,000 to 8,000 draws, it changes by \(0.811-0.817=-0.006\) log-odds units. The movement has become smaller in this sequence, which is evidence of draw-count stability for this parameter over the tested range. The objective values also become less negative, changing by \(0.13\) and then \(0.03\), respectively.

This is a diagnostic, not a proof of convergence to the exact estimator: all three values could share an implementation error, and stability over this range does not rule out larger changes at other draw counts. A useful follow-up is to compare estimates under additional independent simulation designs and to evaluate the objective at candidate parameters using a larger common draw set.

Independent Replications

A different check holds the data and draw count fixed but repeats estimation with independent simulation draws. The resulting spread describes simulation variability conditional on the observed data and the chosen computational procedure. It is not the estimator’s sampling uncertainty across hypothetical new data sets. The two sources of uncertainty were distinguished in the earlier material on separating sampling and simulation uncertainty.

For \(B\) independent runs, let \(\hat{\theta}^{(b)}_R\) be the estimate from run \(b\). The replication mean and sample standard deviation are

$$ \bar{\theta}_{R,B}=\frac{1}{B}\sum_{b=1}^{B}\hat{\theta}^{(b)}_R, \qquad s_{\mathrm{rep}}= \sqrt{\frac{1}{B-1}\sum_{b=1}^{B} \left(\hat{\theta}^{(b)}_R-\bar{\theta}_{R,B}\right)^2}. $$

The standard deviation \(s_{\mathrm{rep}}\) summarizes run-to-run variation. If the runs are independent and have a common distribution, \(s_{\mathrm{rep}}/\sqrt{B}\) estimates the Monte Carlo standard error of their mean, not the Monte Carlo standard error of a single-run estimate. Replications can also reveal failures that a single run hides, such as occasional convergence to a different local optimum.

Worked Example: Quantifying Run-to-Run Variation

Five independent runs of a hypothetical model, each using 4,000 draws and the same fixed data, produce estimates of a parameter measured in years: \(1.84,\ 1.91,\ 1.88,\ 1.87,\ 1.95\).

Their mean is \( (1.84+1.91+1.88+1.87+1.95)/5=9.45/5=1.89 \) years. The deviations from this mean are \(-0.05,\ 0.02,\ -0.01,\ -0.02,\ 0.06\) years. Thus

$$ s_{\mathrm{rep}} =\sqrt{\frac{0.05^2+0.02^2+0.01^2+0.02^2+0.06^2}{4}} =\sqrt{\frac{0.0070}{4}} \approx 0.0418\ \text{years}. $$

The estimated Monte Carlo standard error of the mean of these five runs is \(0.0418/\sqrt{5}\approx0.0187\) years. The run-to-run spread is appreciable relative to the reported estimate, so a single run should not be presented as if its simulation were immaterial. More runs, more draws per run, or investigation of the source of the variability may be warranted. These five runs do not estimate how much the estimate would vary across new samples of data.

Objective and Gradient Checks

A numerical optimizer can stop because an iteration limit was reached, because its step became small, or because a computed gradient appears small. Each condition concerns the implemented objective and algorithm; none alone establishes that the intended statistical objective has been maximized. Inspect the objective values around the reported solution, confirm that small parameter perturbations behave plausibly, and check whether different reasonable starting values lead to comparable solutions.

When an analytic or automatic-differentiation gradient is available, compare it with finite differences. For a scalar objective \(Q\), the central-difference approximation to its derivative at \(\theta\) is

$$ D_h Q(\theta)=\frac{Q(\theta+h)-Q(\theta-h)}{2h}. $$

For a vector parameter, apply this calculation one coordinate at a time, with the other coordinates held fixed. Use the same simulation draws when evaluating the objective at \(\theta+h\) and \(\theta-h\); otherwise, simulation noise can overwhelm the difference being checked. Try more than one step size. A step that is too large has truncation error, while a step that is too small can amplify rounding error or simulation noise.

The central-difference error has a useful justification. If \(Q\) has three continuous derivatives near \(\theta\), Taylor expansion gives \(Q(\theta+h)=Q(\theta)+hQ'(\theta)+h^2Q''(\theta)/2+h^3Q'''(\theta)/6+o(h^3)\), and the corresponding expansion at \(\theta-h\) has the odd-power terms with opposite signs. Subtracting and dividing by \(2h\) therefore gives \(D_hQ(\theta)=Q'(\theta)+h^2Q'''(\theta)/6+o(h^2)\). Thus the central difference has error of order \(h^2\) under this smoothness condition. This calculation does not justify an \(O(h^4)\) remainder without stronger smoothness assumptions.

Worked Example: Checking a Computed Gradient

Consider a hypothetical one-dimensional simulated objective near the candidate \(\theta=2\), with local form \(Q(\theta)=-120+0.03(\theta-2)-(\theta-2)^2\). Its analytic derivative is \(Q'(\theta)=0.03-2(\theta-2)\), so \(Q'(2)=0.030\). Suppose the implementation reports a gradient of \(0.030\) at this point. We check it by central differences using the same draws at each pair of evaluations.

At \(h=0.01\), the objective values are \(Q(2.01)=-119.9998\) and \(Q(1.99)=-120.0004\). Therefore, \(D_{0.01}Q(2)=(-119.9998+120.0004)/(0.02)=0.030\). At \(h=0.005\), the values are \(Q(2.005)=-119.999875\) and \(Q(1.995)=-120.000175\), giving \(D_{0.005}Q(2)=0.000300/0.010=0.030\).

The numerical derivatives agree with the reported gradient to the displayed precision across these step sizes. That supports the gradient implementation for this check, but does not prove the optimizer found a global maximum. Since the gradient is not zero, the candidate is not a stationary point of this particular local objective; an optimizer would need to continue or explain why constraints or stopping tolerances prevent further movement.

Unstable Simulated Probabilities and Weights

Simulation can be especially fragile when an objective uses probabilities inside logarithms or relies on a few draws with very large weights. If a simulated probability \(\hat{p}\) is close to zero, its logarithm is highly sensitive to relative error, and a finite simulation may return zero even when the true probability is positive. Silently replacing zero by an arbitrary small constant changes the objective and can affect the estimate; any regularization or probability floor must be explicitly justified and reported.

For a simple illustration, suppose a probability is estimated by the average of \(R\) independent indicator draws with success probability \(p\). Its variance is \(p(1-p)/R\), so its relative standard error is \(\sqrt{(1-p)/(Rp)}\). This approximation presumes independent draws and the simple indicator estimator; other simulation designs require their own variance calculation. For importance sampling, normalized weights \( \tilde{w}_r=w_r/\sum_{s=1}^{R}w_s \) can be summarized by the effective sample size \(ESS=1/\sum_{r=1}^{R}\tilde{w}_r^2\). It ranges from 1 when a single draw carries all weight to \(R\) when weights are equal. It is a diagnostic summary, not a literal count of independent observations.

Worked Example: A Near-Zero Probability and Concentrated Weights

In a hypothetical model, one observation has a simulated event probability \(p=0.0004\), estimated with \(R=1{,}000\) independent indicator draws. The expected number of simulated successes is \(Rp=0.4\). The relative standard error is

$$ \sqrt{\frac{1-p}{Rp}} =\sqrt{\frac{0.9996}{0.4}} \approx 1.58. $$

The relative error is about 158%, signaling that this simulation is too sparse to estimate the probability reliably for a log-likelihood contribution. Under independent draws, the probability of observing zero successes is \((1-p)^R=(0.9996)^{1000}\approx0.670\). A zero estimate would make the log contribution undefined. At \(R=100{,}000\), the expected success count is 40 and the relative standard error is \(\sqrt{0.9996/40}\approx0.158\), or 15.8%. This is an improvement, but whether it is adequate depends on the required precision and the model’s use of that probability.

Separately, suppose five normalized importance weights are \(0.62,\ 0.18,\ 0.10,\ 0.06,\ 0.04\). They sum to 1, and \(ESS=1/(0.62^2+0.18^2+0.10^2+0.06^2+0.04^2)=1/0.432\approx2.31\). Although five draws were used, the weight concentration corresponds to an effective sample size of only about 2.31. This flags sensitivity to a small number of draws and motivates examining the weight distribution and simulation design.

Putting the Diagnostics Together

No single threshold defines a universally acceptable diagnostic result. Adequacy depends on the scale and purpose of the parameters, the sensitivity of the objective to simulated quantities, and the precision required for the intended inference. A practical assessment records the draw count and design, whether draws are shared across evaluations, optimizer status and tolerances, and the variation across draw counts and independent runs. It also reports gradient discrepancies and relevant probability or weight summaries when those quantities enter the objective.

Interpret discrepancies as clues rather than as automatic evidence of a particular failure. Unstable estimates with increasing draw counts may indicate simulation error, but can also expose a flat objective or weak identification. Stable estimates do not establish correct specification. A gradient mismatch may come from coding, finite-difference step choice, or simulation noise. Low effective sample size signals concentrated weights, but does not alone quantify bias. Follow the symptom with a targeted check and document changes made to the computation.

  • Draw-count sensitivity: compare estimates and objective behavior over increasing draw counts.
  • Independent replications: measure run-to-run simulation variability conditional on the data.
  • Optimization checks: inspect local objective behavior, starting values, and gradient agreement.
  • Simulation stability: examine near-zero probabilities, zero simulated events, and weight concentration.
Common pitfall: “The optimizer converged, and the estimate barely changed when I doubled the draws, so the result is verified.” This reasoning treats two limited checks as proof. Convergence refers to the implemented numerical objective, while limited draw-count stability does not rule out shared simulation error, weak identification, a coding mistake, or instability in rare probabilities. Report the checks, test independent replications and gradients where appropriate, and qualify the conclusion according to what those checks actually establish.

Check Your Understanding

Use the distinctions in this tutorial to answer the following questions.

  1. Why is a comparison of estimates at two draw counts not, by itself, proof that simulation error is negligible?
  2. What uncertainty does the standard deviation across independent simulation runs describe when the data are held fixed?
  3. Why should the same simulation draws be used for the two objective evaluations in a finite-difference gradient check?
  4. For an indicator-based probability estimate with \(Rp=0.25\), what concern does the expected number of successes raise for a log-likelihood calculation?
  5. What does an effective sample size of 2.3 indicate about a set of normalized importance weights, and what does it not mean?
Clinical Biostats