Tutorials › Econometrics (Graduate) › Simulation Bias and Variance in Integral Estimates

Simulation-Based Estimation · Tutorial 894 of 952

Simulation Bias and Variance in Integral Estimates

Learn to quantify simulation error in an integral estimate and to distinguish an unbiased estimate from a biased nonlinear transformation of it.

Advanced 10 min read

What You'll Learn

  • Define bias, variance, and mean squared error for a simulated integral estimate.
  • Derive why an average of independent integrand draws is unbiased for the integral.
  • Calculate the simulation variance and standard error from the integrand variance.
  • Explain why the logarithm of an unbiased positive estimate is generally downward biased.
  • Use a Taylor expansion to approximate the bias and variance of a log integral estimate.
  • Distinguish simulation uncertainty from uncertainty due to sampling the data.

Why Simulation Error Has More Than One Form

A simulated integral is random because it depends on random draws, even when the quantity being integrated is fixed. For an ordinary average of simulated integrand values, the simulation error has a particularly direct description: its expectation equals the integral, and its variance decreases as the number of independent draws increases. But econometric calculations often use the integral inside another function. Taking its logarithm, for example, can introduce bias even when the integral estimate itself is unbiased. Keeping these two sources of error distinct matters when interpreting simulated likelihood contributions and other transformed quantities.

Here, the integral is treated as fixed, conditional on the data and parameter values at which it is evaluated. The randomness discussed is only the randomness of the simulation draws. It is therefore separate from sampling uncertainty in the observed data or uncertainty about an estimated parameter.

Bias and Variance of a Simulated Integral

Suppose an integral can be written as an expectation \(I=E[h(U)]\), where \(U\) has a specified distribution and \(h(U)\) is the integrand evaluated at a draw from that distribution. Draw \(U_1,\ldots,U_R\) independently from the same distribution, and let \(Y_r=h(U_r)\). The basic simulated estimate is the average of these \(R\) integrand draws.

Definition: The Monte Carlo estimate of \(I=E[h(U)]\) based on \(R\) independent, identically distributed draws is \(\hat I_R=R^{-1}\sum_{r=1}^R h(U_r)\). Its simulation bias is \(E[\hat I_R]-I\), its simulation variance is \(\operatorname{Var}(\hat I_R)\), and its mean squared error is \(E[(\hat I_R-I)^2]\). Expectations and variances here are over the simulation draws, with the target integral held fixed.

The standard results require that the draws are independent and identically distributed from the distribution defining the expectation, and that the integrand has finite mean and variance: \(E[h(U)]=I\) and \(\operatorname{Var}(h(U))=\sigma_h^2<\infty\). No assumption that the integrand is normally distributed is needed for the expectation and variance calculations.

Theorem: Under these assumptions, \(E[\hat I_R]=I\) and \(\operatorname{Var}(\hat I_R)=\sigma_h^2/R\). Thus \(\hat I_R\) is unbiased for the integral, its simulation standard error is \(\sigma_h/\sqrt R\), and its mean squared error is \(\sigma_h^2/R\).

Why the Basic Estimate Is Unbiased

The result follows from linearity of expectation and independence across draws. The variance calculation uses independence to eliminate the covariance terms. Showing both steps makes clear which assumption is doing the work.

$$ \begin{aligned} E[\hat I_R] &=E\!\left[\frac{1}{R}\sum_{r=1}^R h(U_r)\right]\\ &=\frac{1}{R}\sum_{r=1}^R E[h(U_r)] =\frac{1}{R}(RI)=I,\\[4pt] \operatorname{Var}(\hat I_R) &=\operatorname{Var}\!\left(\frac{1}{R}\sum_{r=1}^R h(U_r)\right)\\ &=\frac{1}{R^2}\sum_{r=1}^R\operatorname{Var}(h(U_r)) =\frac{1}{R^2}(R\sigma_h^2) =\frac{\sigma_h^2}{R}. \end{aligned} $$

For any estimator with finite second moment, mean squared error is variance plus squared bias. In this case the bias is zero, so the mean squared error equals the variance. Increasing \(R\) by a factor of four halves the simulation standard error and reduces variance and mean squared error by a factor of four. It does not make any one finite-run estimate equal to the target; rather, it reduces its dispersion across repeated simulations.

Worked Example: Bias and Variance for a Simple Integral

Suppose \(U\) takes values 0 and 1 with probability \(1/2\) each, and the integrand is \(h(U)=1+2U\). Thus the simulated integrand value is 1 or 3, each with probability \(1/2\). Find the integral and the bias, variance, and standard error of the estimate based on \(R=4\) independent draws.

The integral is the expected integrand value:

$$ I=E[h(U)]=\frac{1}{2}(1)+\frac{1}{2}(3)=2. $$

The integrand variance is

$$ \sigma_h^2=E[(h(U)-2)^2] =\frac{1}{2}(1-2)^2+\frac{1}{2}(3-2)^2=1. $$

Consequently, the four-draw estimate has expectation 2, so its bias is \(2-2=0\). Its variance and standard error are

$$ \operatorname{Var}(\hat I_4)=\frac{1}{4}=0.25, \qquad SE(\hat I_4)=\sqrt{0.25}=0.5. $$

For example, if the realized integrand draws are 1, 3, 3, and 1, then the estimate is \((1+3+3+1)/4=2\). That particular estimate happens to equal the integral, but the calculated standard error describes variation over repeated sets of four draws, not uncertainty about whether this realized value is correct.

When \(\sigma_h^2\) is unknown, it can be estimated from the simulated values \(Y_1,\ldots,Y_R\). Their sample variance is \(s_h^2=(R-1)^{-1}\sum_{r=1}^R(Y_r-\hat I_R)^2\), giving the estimated Monte Carlo standard error \(s_h/\sqrt R\). This estimates the variability due to simulation; it does not measure uncertainty from the original data.

Taking a Logarithm Introduces a Different Bias

An unbiased estimate does not remain unbiased after an arbitrary nonlinear transformation. Let \(I>0\), and suppose \(Y_r=h(U_r)>0\) almost surely, so that \(\hat I_R>0\) and its logarithm is defined. If the logarithm is integrable, Jensen's inequality for the concave function \(\log(x)\) gives

$$ E[\log(\hat I_R)]\leq \log(E[\hat I_R])=\log(I). $$

Therefore, the plug-in estimate \(\log(\hat I_R)\) is generally downward biased for \(\log(I)\). The inequality is strict when \(\hat I_R\) is nonconstant and the relevant expectations exist. The source of this bias is the curvature of the logarithm, not bias in the simulated integral estimate. In contrast, \(\log(I)\) is the log of the target integral; it is not the average of the logarithms of the simulated integrand values.

If the integrand can be zero, a finite-run estimate may also be zero, in which case its logarithm is undefined. A log-transformation analysis therefore needs to address positivity as well as bias. Positivity of every simulated value ensures a positive finite-run average, though conditions ensuring that the expected log exists are still needed for an expectation-based bias statement.

Worked Example: Exact Downward Bias for a Log Estimate

Use the same two-point integrand as above: each simulated value \(Y_r\) is 1 or 3 with probability \(1/2\), and \(I=2\). For \(R=2\), compute the expected logarithm of the simulated integral estimate and compare it with \(\log(I)\).

The estimate \(\hat I_2=(Y_1+Y_2)/2\) equals 1 if both draws are 1, equals 2 if the draws differ, and equals 3 if both draws are 3. These outcomes have probabilities \(1/4\), \(1/2\), and \(1/4\), respectively. Thus

$$ \begin{aligned} E[\log(\hat I_2)] &=\frac{1}{4}\log(1)+\frac{1}{2}\log(2)+\frac{1}{4}\log(3)\\ &=0+\frac{1}{2}(0.6931)+\frac{1}{4}(1.0986)\\ &=0.6212. \end{aligned} $$

The target is \(\log(I)=\log(2)=0.6931\). The bias is therefore \(0.6212-0.6931=-0.0719\), in log units. This is a finite-simulation downward bias even though \(E[\hat I_2]=2\) exactly. The calculation also illustrates why applying a logarithm after averaging is not equivalent to averaging log values.

Approximating the Bias and Variance of the Log Estimate

For a larger number of draws, a Taylor expansion gives useful approximations. Write \(\delta=\hat I_R-I\), so that \(E[\delta]=0\) and \(E[\delta^2]=\sigma_h^2/R\). When \(I>0\), expand the logarithm around \(I\):

$$ \log(I+\delta) =\log(I)+\frac{\delta}{I}-\frac{\delta^2}{2I^2}+\text{higher-order terms}. $$

Taking expectations removes the first-order term because \(E[\delta]=0\). Under regularity conditions that make the expected higher-order remainder negligible relative to \(1/R\), such as bounded integrand values bounded away from zero, the leading bias is

$$ E[\log(\hat I_R)]-\log(I) \approx -\frac{1}{2I^2}\operatorname{Var}(\hat I_R) =-\frac{\sigma_h^2}{2RI^2}. $$

This approximation identifies the scale of the bias: it is approximately proportional to the variance of the integral estimate and inversely proportional to the square of the integral. It is a large-\(R\) approximation, not an exact correction for every finite number of draws.

For the leading variance approximation, retain the first-order term \(\delta/I\). Its variance is \(\operatorname{Var}(\delta/I)=\sigma_h^2/(RI^2)\). Under the same type of regularity conditions, this yields

$$ \operatorname{Var}(\log(\hat I_R)) \approx \frac{\sigma_h^2}{RI^2}. $$

The corresponding approximate standard error is \(\sigma_h/(\sqrt R I)\). In practice, replacing \(\sigma_h\) with the sample standard deviation \(s_h\) gives an estimated simulation standard error. These approximations describe how the random log estimate varies around its own expectation; they do not remove its downward bias.

Worked Example: Approximate Error for a Log Integral

Suppose a positive integrand takes the values 2 and 6 with equal probability. Then \(I=4\), and the integrand variance is \(\{(2-4)^2+(6-4)^2\}/2=4\). For \(R=25\), calculate the simulation variance and standard error of the integral estimate, then approximate the bias and standard error of its logarithm.

For the untransformed estimate,

$$ \operatorname{Var}(\hat I_{25})=\frac{4}{25}=0.16, \qquad SE(\hat I_{25})=\sqrt{0.16}=0.4. $$

The leading log-bias approximation is

$$ -\frac{\sigma_h^2}{2RI^2} =-\frac{4}{2(25)(4^2)} =-0.005. $$

Thus the expected log estimate is approximately \( \log(4)-0.005=1.3813\), compared with the target \(\log(4)=1.3863\). The approximate variance and standard error of the log estimate are

$$ \operatorname{Var}(\log(\hat I_{25})) \approx \frac{4}{25(16)}=0.01, \qquad SE(\log(\hat I_{25}))\approx 0.1. $$

The bias approximation is small relative to the approximate standard error here, but it is not zero. Both approximations concern simulation error only and rely on the large-\(R\) expansion; the exact log bias for a particular finite \(R\) need not equal \(-0.005\).

What These Results Do and Do Not Say

For the basic simulated average, the finite-sample result is exact: under independent draws with the correct distribution and finite integrand variance, it is unbiased and its variance is \(\sigma_h^2/R\). The log-bias result is different. Jensen's inequality establishes the direction of bias under its stated conditions, while the Taylor calculation supplies a leading approximation under additional regularity conditions.

These distinctions are useful whenever an integral is an intermediate quantity. One can report the simulated integral estimate and its Monte Carlo standard error, then separately consider the effect of using a transformation such as a logarithm. Increasing the number of draws reduces the variance of the integral estimate and, in the regular setting above, reduces the leading log bias at rate \(1/R\). It does not turn the log of a finite-run estimate into an exactly unbiased estimate of the log integral.

Common mistake: “The simulated integral average is unbiased, so its logarithm is unbiased too.” This does not follow: unbiasedness is preserved by linear transformations, not generally by nonlinear ones. For a positive nonconstant estimate, concavity gives \(E[\log(\hat I_R)]<\log(I)\) when the expectations exist. Assess the transformed quantity on its own scale.

Check Your Understanding

Use the definitions and results above to answer these questions.

  1. State the assumptions under which the average of simulated integrand values is unbiased for the integral.
  2. If the integrand variance is 9 and the number of independent draws is 36, what are the variance and standard error of the simulated integral estimate?
  3. Why does independence matter in the variance derivation?
  4. For a positive, nonconstant integral estimate, what does Jensen's inequality say about the expected log estimate relative to the log of the target integral?
  5. Give the leading large-\(R\) approximations to the bias and variance of \(\log(\hat I_R)\), and identify the quantities they depend on.
  6. Explain why a Monte Carlo standard error for a simulated integral does not measure uncertainty due to sampling the observed data.
Clinical Biostats