A Monte Carlo method approximates a deterministic quantity using averages of simulated random variables and controls the approximation with probabilistic limit theorems.
Unbiased random termination of a sampled contribution: retain it with probability and multiply surviving contributions by . In path tracing this controls path length without the systematic truncation of a fixed bounce limit, provided the continuation probabilities and weights are handled consistently.
Stochastic methods for quantum many-particle expectation values or ground-state projection. Variational and diffusion approaches can include correlations beyond a single Slater determinant; fermion signs or nodal constraints and finite-system extrapolation require explicit control.
A pseudorandom number generator is a deterministic state-update algorithm producing numbers intended to imitate an independent sequence from a prescribed probability distribution. For Monte Carlo integration, desirable features include good one-dimensional and multidimensional uniformity, a period far longer than the calculation, negligible detectable dependence, reproducible seeds, sufficient numerical precision and fast generation. Uniform marginal distributions alone do not provide independent draws.
A value initializing a pseudorandom generator. Repeating a seed need not reproduce a parallel stochastic calculation unless the generator, stream assignment and implementation are also controlled.
A pseudorandom number generator whose state sequence combines earlier values at two fixed lags, for example with . A seed supplies the first values. A circular buffer of entries suffices for generation because each update uses only the retained lag window.
A pseudorandom number is an output of a deterministic algorithm chosen to imitate samples from a specified probability law. For example, a linear congruential generator returns fractions on a finite grid in . Their intended uniform distribution is an approximation, and their serial dependence must be assessed separately from the generator's period.
Choose integers , , and a seed . Iterate and return . This gives a deterministic finite-state pseudorandom number generator with output in . A nonzero increment gives a mixed generator; gives a multiplicative generator. Its period is at most , but even a full period does not guarantee good multidimensional uniformity or statistical independence.
A linear congruential generator has period for every seed if and only if , every prime dividing divides , and implies . The coprimality of prevents the orbit from being trapped in a residue class; the multiplier conditions permit full-period lifting through each prime power. Combining the prime-power periods by the Chinese remainder theorem gives period . For , the multiplier criterion reduces to , together with . A positive increment alone is insufficient.
To calculate , generate independent with density and average . Integrability gives convergence by the strong law of large numbers; finite variance gives an unbiased estimate with variance . Applying this to indicators estimates probabilities. Correlated Markov chain Monte Carlo samples can also approximate the integral, but their error is determined by the chain's dependence rather than the independent-sample variance formula.
Antithetic variates deliberately couple unbiased estimators of the same expectation with negative covariance. Their average can have smaller variance than an average using independent draws. For example, evaluating a monotone integrand at and , where has a uniform distribution, gives opposite fluctuations while preserving both marginal distributions.
For standard Cauchy distribution probability density function and , this estimates its upper-tail probability without sampling a heavy tail. The function decreases on , while increases, so their covariance is nonpositive. The paired estimator is unbiased and has no larger variance than an estimator using the same number of independent probability density function evaluations.
For two unbiased estimators of the same parameter with variances and covariance , the fixed-weight estimator is unbiased and has variance . Completing the square gives and minimum variance when the denominator is positive. These are optimal among fixed linear unbiased combinations. Substituting weights estimated from the same observations need not preserve unbiasedness.
Split independent observational blocks into two folds. Use one fold to estimate the combination weight for the two sample means in the other fold, and conversely. Each held-out combination is an unbiased estimator conditionally on its training fold because its two held-out sample means have the same expectation. A deterministic average of the two combinations remains unbiased. Under consistency of the moment estimates and balanced fold sizes, the weights approach those of the minimum-variance combination of unbiased sample means. Paired observations must stay together when splitting or bootstrapping so their covariance is preserved.
Replacing a simulated quantity by preserves its expectation and reduces variance by the law of total variance. This is Rao-Blackwellization. For a random sum, conditioning on the count and all but one summand replaces an event indicator by a cumulative distribution function evaluation. The resulting estimator needs that conditional expectation to be computable.
Independent uniform distribution draws on produce independent standard normal distribution draws and . The proof transforms an independent uniform angle and radial density through the polar-coordinate Jacobian.
If is uniform on , the displayed random variable is not standard normal. For it is nonnegative; for , its radius is at most , so it is always bounded below by . A standard normal distribution has an unbounded lower tail.
The Box-Muller transform instead uses a common radius independent of the angle in both Cartesian coordinates. Their polar density is , and dividing by the coordinate Jacobian gives the product of two standard normal densities. Changing a logarithm's uniform input changes the distribution, even if the resulting expression superficially resembles that formula.
Nested Monte Carlo approximates an outer expected value whose integrand contains another expected value. A nonlinear transformation, such as a logarithm, of an inner sample average usually introduces finite-sample bias. Increasing both sample sizes requires suitable integrability controls to establish consistency; an unbiased estimator of the inner quantity does not make its logarithm unbiased.
A Monte Carlo estimator is a random approximation obtained from simulated samples, commonly a sample average or a weighted sample average.
For observations, taking the mean of their scalar sum returns that sum, not their sample mean. If is unbiased for a target, replacing the mean by a sum gives expected value and multiplies its variance by . A mean-zero control variate changes variance but cannot correct this missing normalization factor.
At equal proposal count, compare for unnormalized importance sampling with for the accepted-sample mean. There is no universal ordering for nonzero target mean. For zero mean, the bounded-weight inequality gives importance sampling no larger asymptotic variance. Empty rejected samples and per-proposal computational cost are separate considerations.
An additive constant leaves the target variance and accepted-sample mean variance unchanged, but changes the variance of unnormalized importance sampling because its random weights do not sum to one. With g uniform on (0,1), f(x)=2x and M=2, phi(x)=x gives importance variance 16/45 versus rejection proposal-budget variance 1/9. Replacing phi by x-1 gives importance variance 1/45 with the same rejection variance, reversing preference.
A control variate is a random variable with known expected value whose centered value is subtracted from a Monte Carlo estimator to reduce its variance. For a mean-zero vector , put and . When is invertible, the optimal estimator averages and has variance for independent draws. Improvement is strict exactly when .
If is an unbiased estimator and a vector has known mean, then remains unbiased for a deterministic coefficient vector. Its variance is , where and . For invertible , completing the square gives the displayed optimum and minimum variance . With singular , use a generalized inverse on its range. Estimating coefficients from the same simulation can introduce finite-sample bias; fixed pilot coefficients or independent training preserve the elementary unbiasedness assertion.
For uniform on , put and . Then , and estimates the standard Cauchy distribution probability above two. Its variance is , minimized by the displayed coefficient. Here and , so the optimal coefficient is negative. A coefficient estimated using a separate pilot can be fixed for a fresh unbiased production sample.
If a smooth posterior density has vanishing boundary terms, its log-posterior gradient satisfies and
This is a posterior integration-by-parts identity; it concerns differentiation in the random parameter, distinct from the usual mean-zero score identity for sampling distributions. It makes a vector control variate. Finite moments and known coefficients preserve unbiasedness of the Monte Carlo estimator.
Monte Carlo error is the random difference between a simulation estimate and the exact quantity it approximates. For an average of independent finite-variance draws, its standard deviation is proportional to the inverse square root of the number of draws.
The Monte Carlo standard error estimates the standard deviation of a simulation-based estimate across repeated simulation runs. For an average of independent random variables with finite variance , it is . Under a suitable central limit theorem for Markov chain Monte Carlo, correlated draws instead give the approximation , where is the effective sample size of a Markov chain for the particular estimated function . This measures numerical uncertainty in an estimate, not uncertainty in the unknown parameter itself.
Suppose is a target probability density and is a proposal density with . Draw and an independent , and accept when
The accepted value has density , the acceptance probability is , and the expected number of proposals is .
Stopping after a fixed number of rejection sampling proposals preserves the target law of accepted labels, conditional on the number accepted. Stopping instead after a fixed amount of elapsed computing time can change the finite-sample law if processing costs depend on the proposed state. The deadline may censor precisely the expensive states.
For an exact counterexample, let both target and proposal be uniform on two states, so every proposal is accepted. Let processing cost be one time unit for the first state and two for the second. Stop between one and two units and retain only finished proposals. Conditional on obtaining an output, the first state is the only possible value, despite its target probability being one half. This proves that a runtime cutoff need not be an unbiased stopping rule for the realized finite output. It does not imply asymptotic bias of the indefinitely growing completed sequence; it identifies a finite-horizon censoring effect.
Consider independent rejection sampling trials with proposal density , accepted-value density , acceptance probability and rejection probability . Splitting the proposal law by its accept/reject outcome gives , where is the rejected-proposal distribution.
If an algorithm permits trials, returns the first accepted value when one occurs, and otherwise returns the final rejected proposal, its output density is the displayed mixture. The event of failures has probability and gives the conditional law ; every successful stopping trial gives law . Hence the forced return introduces bias unless , and its contribution decays geometrically with the cap. Conditional on success before any specified trial, the output still has law , since accepted value and successful-trial index are independent.
For a Poisson distribution target of mean and a geometric distribution proposal with probability mass function on the nonnegative integers, the tight rejection sampling envelope is
Successive target-to-proposal ratios have ratio , proving this maximizing index. The function is the maximum of the convex functions . Within a branch its derivative is .
Writing , the optimum is , and the success parameter is . For , is a branch boundary; the left and right derivatives are nonpositive and nonnegative respectively. For , the active branch has a zero derivative at , including a tie at the upper endpoint. Convexity proves global optimality. The minimum expected proposal count is ; no claim about machine-specific instruction costs is implied.
Draw proposals with probability density function or probability mass function , independently draw from the uniform distribution on , and repeat until for a nonnegative threshold . The actual acceptance probability given is . If , the returned probability distribution has density or mass . Indeed the joint law of a proposal and acceptance has density or mass , and conditioning on acceptance divides by . Summing over failed trials gives the same law and expected trial count . Thresholds exceeding one cannot be used as unbounded reweighting factors.
A lower envelope can save evaluations of an expensive unnormalized target in rejection sampling. Draw with probability density function and an independent uniform distribution value . Accept immediately if . Otherwise draw a fresh independent uniform distribution value and accept if
For a fixed proposal, writing , and gives total acceptance probability . If , the first stage accepts with probability one and the residual test is skipped. Thus the accepted probability density function is , and the overall acceptance probability is . The probability of avoiding a target evaluation on one proposal is .
If , and for a proposal probability density function , accept a proposal when an independent uniform distribution value is at most . Integrating the joint acceptance probability density function gives and conditional accepted probability density function . For independent proposals the accepted count has binomial distribution with parameters .
For target density proportional to on , use the Pareto distribution proposal with . Its density ratio is proportional to , maximized at if that point exceeds . The tight envelope yields the highest acceptance probability for this fixed proposal. An inverse draw is with uniformly distributed on .
For , the maximum of on occurs at . If one parameter is one, the maximum is attained at the corresponding endpoint; if both are one, is constant. Let . Accept an independent uniform distribution proposal when another uniform draw is at most . The accepted probability density function is the beta distribution, and acceptance probability is .
With proper prior independent of the neutral Kingman's coalescent times, propose from their joint prior and accept with probability . The accepted density is proportional to the prior times the observed-count likelihood, hence is the posterior given . The acceptance rate is the prior predictive probability . For , divide the acceptance function by its maximum , achieved at , to improve the rate to without altering the accepted distribution. For , .
For a proper prior distribution independent of coalescent times , let with and . Observing under an infinite sites mutation model gives posterior density , where is the prior predictive probability of . Multiplication by the conditional Poisson mass and normalization is an application of Bayes' theorem.
// Target: statistical-inference.bigb
Accepting a fresh uniform deck permutation with a probability depending only on whether its endpoint ranks match preserves uniform individual rank marginals by symmetry. It changes their joint law. For four cards of each of thirteen ranks and rejection probability on a mismatch, the accepted matching probability is . The two accepted ranks are independent precisely at ; equality of marginals alone does not imply independence.
Write . Against an exponential distribution proposal of mean , the chi-squared distribution density has envelope constant . The density ratio divided by is . Thus generate and accept when for independent uniform distributions. The inequality validates the acceptance probability. The accepted probability density function is the target because rejection sampling weights the proposal by its target-to-envelope ratio.
For a nonnegative integrable function with integral , its ratio-of-uniforms region has area . A uniform point in the region transforms under with Jacobian determinant ; integrating over gives density . A rectangle containing the region gives a practical rejection sampling algorithm using only uniform random variables, with acceptance .
For the unnormalized Laplace distribution probability density function , the ratio-of-uniforms method uses . The maximum of is one. On , the maximum of occurs at and equals . On , it occurs at and equals . Thus the displayed rectangle contains the region. Its area is , while the target region has area . Uniform proposals in the rectangle, accepted when , therefore return the correct Laplace distribution with acceptance probability .
For the unnormalized normal density , the smallest axis-aligned envelope is and . The boundary reaches that width at . Region area is , so the acceptance rate is , independently of . Multiplying by a positive constant rescales both coordinates and their areas consistently.
A finite bounding rectangle exists when and are bounded. This is not automatic for every probability density function: tails proportional to give an unbounded second coordinate. In principle any finite-area measurable region has an open envelope of finite area, decomposable up to null boundaries into disjoint dyadic rectangles. Select a rectangle with probability proportional to its area, then sample its two coordinates uniformly and reject outside the target region. The accepted point is uniform on the region, with acceptance equal to the ratio of their areas. Constructing an effective envelope remains a density-specific computational step.
For the half-normal distribution, the density ratio to is maximized at . Completing the square gives the envelope constant above and acceptance probability . Its logarithmic derivative is , so the optimal rate is . Give an accepted nonnegative value an independent fair sign to obtain the standard normal distribution. The expected number of proposals is , while the probability of rejecting one proposal is ; these are different quantities.
Reject pairs of independent uniform coordinates from the square until their squared radius lies in . Multiply each coordinate by to obtain two independent variables with the standard normal distribution. Squaring either gives a chi-squared variable with one degree of freedom.
For n independent proposals and an envelope constant , each rejection decision succeeds with probability . The accepted count is Bin(n,1/M). Conditional on any acceptance pattern, the accepted values have independent target density f; summing over patterns preserves that product law conditional on the count. The empty-output probability is .
For rejection sampling with acceptance probability , , the accepted count in trials has binomial distribution, mean and variance . To obtain at least acceptances with approximate probability , use the standard normal distribution quantile . The central limit theorem without continuity correction gives . Solving this quadratic inequality in gives the displayed threshold, rounded upward. It exceeds the average stopping cost because it allows for fluctuations in the accepted count. For , the count is deterministic and exactly. Exact coverage uses the binomial distribution tail rather than the approximation.
Conditional iid accepted values have the ordinary target-sample CLT at scale . Since , the same estimator has asymptotic variance at scale . The centered count has limiting variance . Any fixed convention on an empty output is asymptotically negligible.
With normalized densities and envelope , , conditioning a proposal on rejection gives density . It can be used as an importance sampling proposal only if it covers the relevant target support. If on a set of positive target mass, rejected draws never visit that set.
Adaptive rejection sampling builds a piecewise linear upper envelope for a differentiable log-concave probability density, samples from its piecewise exponential form, and accepts with the target-to-envelope ratio. Adding evaluated points improves the envelope without changing the target distribution. Initial tangent slopes must yield integrable tails. The accepted draws are exact samples, unlike a finite run of Markov chain Monte Carlo.
To estimate , sample independently from a reference density whose support covers that of , and use
The summands have expectation , and the strong law of large numbers gives almost-sure convergence under integrability.
To estimate for a standard normal variable using proposal , the weighted indicator has second moment . Differentiating it at a minimum gives the displayed equation. Since , the minimizing shift is half the target conditional mean above the shifted threshold. The resulting estimator remains unbiased with the exact likelihood-ratio weight.
For target and proposal , this is the importance weight. Assuming only , the weighted estimator has guaranteed finite variance for , since . For every , choosing with gives finite target second moment but infinite weighted second moment. With the additional assumption that is bounded, the sufficient range is instead . The integrand hypothesis therefore matters.
Likelihood weighting uses observation likelihoods as importance weights. If parameters are drawn independently from their prior distribution , weight a draw by and estimate a posterior expectation of by . With positive finite evidence and integrable weighted quantities, the strong law of large numbers proves consistency of this self-normalized importance sampling ratio. Finite-sample bias and concentration of the weights remain possible. A different proposal requires the additional prior density-to-proposal density ratio.
Let be an unnormalized density, with , and . Given independent draws and an evaluable normalized density supported where , reciprocal importance sampling estimates by . Its expectation is and its variance is . Broad tails of relative to can make this infinite; reversing the importance sampling ratio reverses the dangerous tail mismatch. Taking the reciprocal of the estimate is generally biased for .
For uniform on , has density on . The importance sampling weight for the standard Cauchy distribution tail is , and its expectation is the target tail probability. Writing gives and by integrating . The weight varies only between and , making its variance much smaller than that of a rare-event indicator. This is a comparison of sampling variances, not a deterministic ordering of every pair of empirical variance estimates.
For rejection indicators with conditional acceptance , the conditional expectation of given all proposals is the unnormalized importance estimator. The Rao-Blackwell theorem reduces variance relative to that fixed-denominator estimator. It gives no such automatic comparison with the accepted-sample mean, whose denominator is the random count.
If , the importance weight is bounded by , and . A finite target second moment therefore guarantees finite variance and the iid central limit theorem for the unnormalized importance-sampling average. Its proposal-budget variance is .
For and , the proposal minimizes the variance of the ordinary unbiased importance sampling estimator. The Cauchy-Schwarz inequality gives , so the minimum variance for independent samples is . The proposal need only cover the nonzero integrand.
An importance sampling proposal must be positive wherever the target-weighted integrand can contribute. The usual sufficient condition is that the target probability is absolutely continuous with respect to . Otherwise multiplying observed draws by cannot recover a missing part of the integral. A strict rejection envelope supplies this condition for the rejected-proposal distribution.
For target density and proposal density , the importance weight is the density ratio wherever the target is supported.
For an unnormalized target density, self-normalized importance sampling uses weights and estimates expectations by . Resampling a point with probability proportional to produces the associated weighted empirical distribution.
For estimating by the unbiased importance estimator , the proposal minimizing variance is
This follows from the Cauchy-Schwarz inequality. Its normalizing constant and dependence on the particular integrand often make it impractical.
For normalized importance weights , the standard effective sample size is .

Articles by others on the same topic (1)

The Monte Carlo method is a statistical technique used to approximate solutions to quantitative problems that might be deterministic in nature but are complex enough to make exact calculations infeasible. It relies on random sampling and statistical modeling to estimate numerical outcomes. The method is named after the Monte Carlo Casino in Monaco, reflecting its inherent randomness similar to games of chance.