ΘρϵηΠατπ

Cumulative Distribution Function
Suppose that X is a random variable. The cumulative distribution function of X is the function FX:[0,1] defined by FX(x):=P(Xx).
Joint Density Function
Suppose that X and Y are real-valued random variables. A function p:2[0,) is a joint density function for (X,Y) if, for every suitable set A2, P((X,Y)A)=Ap(x,y)dxdy.
Marginal Density Function
Suppose that p(x,y) is a joint density function. The marginal density function of X is pX(x):=p(x,y)dy.
Conditional Density Function
Suppose that p(x,y) is a joint density function and pX(x)>0. The conditional density function of Y given X=x is pY|X(y|x):=p(x,y)pX(x).
Joint Density Factors as Marginal Times Conditional Density
Suppose that p(x,y) is a joint density. Then p(x,y)=pX(x)pY|X(y|x) whenever pX(x)>0.
Estimator
Suppose that Q is a fixed quantity to be estimated. An estimator for Q is a real-valued random variable Q^ whose values are used as approximations to Q. In practice, Q^ is often a function of random samples, so its value changes with the sampled outcomes while Q stays fixed.

For example, Q might be the true average height of every adult in a country. Measuring every adult is unrealistic, so we randomly sample some people and compute a sample average Q^. The true average Q is fixed, but the sample average Q^ is random because a different sample can give a different value.

Unbiased Estimator
Suppose that Q^ is an estimator for Q. The estimator Q^ is unbiased if E(Q^)=Q.
Biased Estimator
Suppose that Q^ is an estimator for a fixed Q. The bias of Q^ is the difference between the average value of the estimator and the target value: E(Q^)Q. The estimator is biased if its bias is not 0.
Monte Carlo Estimator
Suppose that Dn, f:D, and p is a density function on D such that p(x)>0 whenever f(x)0. If X1,,XN are independent samples with density p, the Monte Carlo estimator for Q:=Df(x)dx is FN:=1Ni=1Nf(Xi)p(Xi).
Monte Carlo Estimator is Unbiased
Under the hypotheses of the Monte Carlo estimator, E(FN)=Df(x)dx.
By the linearity of expectation for finite sums, E(FN)=E(1Ni=1Nf(Xi)p(Xi))=1Ni=1NE(f(Xi)p(Xi)). Since each Xi has density p, the expectation of the weighted sample is E(f(Xi)p(Xi))=Df(x)p(x)p(x)dx=Df(x)dx. Therefore E(FN)=1Ni=1NDf(x)dx=Df(x)dx. By the definition of unbiased estimator, FN is unbiased for Q.
Uniform Monte Carlo Estimator is Unbiased
Suppose that a,b, a<b, and f:[a,b]. If X1,,XN are independent samples from the uniform density on [a,b], then FN:=baNi=1Nf(Xi) satisfies E(FN)=abf(x)dx.
The uniform density on [a,b] is p(x)=1ba for x[a,b]. By linearity of expectation for finite sums, E(FN)=E(baNi=1Nf(Xi))=baNi=1NE(f(Xi)). Since each Xi has density p, expectation of a function of a continuous random variable gives E(f(Xi))=abf(x)p(x)dx=abf(x)1badx. Thus E(FN)=baNi=1Nabf(x)1badx=1Ni=1Nabf(x)dx=abf(x)dx.
Variance of an Average of Independent Identically Distributed Random Variables
Suppose that X1,,XN are independent identically distributed random variables with finite variance. Then Var(1Ni=1NXi)=Var(X1)N.
Let S:=i=1NXi. By linearity of expectation, E(S)=i=1NE(Xi). Therefore SE(S)=i=1N(XiE(Xi)). Now apply the definition of variance: Var(S)=E((i=1N(XiE(Xi)))2). To see the square expansion, first use distributivity on an arbitrary finite sum: (i=1NYi)2=(i=1NYi)(j=1NYj)=i=1Nj=1NYiYj. The terms with i=j are the diagonal terms Yi2. The terms with ij occur in pairs: for each i<j, the double sum contains both YiYj and YjYi, and these are equal. Hence (i=1NYi)2=i=1NYi2+21i<jNYiYj. Applying this with Yi=XiE(Xi) gives (i=1N(XiE(Xi)))2=i=1N(XiE(Xi))2+21i<jN(XiE(Xi))(XjE(Xj)). Taking expectations and using linearity of expectation, Var(i=1NXi)=i=1NE((XiE(Xi))2)+21i<jNE((XiE(Xi))(XjE(Xj))). The first expectation is Var(Xi) by the definition of variance. The second expectation is Cov(Xi,Xj) by the definition of covariance. Hence Var(i=1NXi)=i=1NVar(Xi)+21i<jNCov(Xi,Xj). Since the random variables are independent, they are uncorrelated, so each covariance term is 0. Since they are identically distributed, each variance is Var(X1). Therefore Var(i=1NXi)=NVar(X1). Finally, scaling by 1/N scales variance by 1/N2, so Var(1Ni=1NXi)=1N2NVar(X1)=Var(X1)N.
Monte Carlo Estimator Variance
Under the hypotheses of the Monte Carlo estimator, define Y:=f(X1)p(X1). If Y has finite variance, then Var(FN)=Var(Y)N.
The random variables f(Xi)/p(Xi) are independent and identically distributed because the samples X1,,XN are independent and identically distributed. Apply variance of an average of independent identically distributed random variables to FN=1Ni=1Nf(Xi)p(Xi).
Mean Squared Error
Suppose that Q^ is an estimator for Q. The mean squared error of Q^ is MSE(Q^):=E((Q^Q)2).
Unbiased Estimator MSE is Variance
If Q^ is an unbiased estimator for Q, then MSE(Q^)=Var(Q^).
Since Q^ is unbiased, E(Q^)=Q. Substituting this into the mean squared error gives MSE(Q^)=E((Q^E(Q^))2), which is exactly the variance of Q^.
Monte Carlo Efficiency
If F is an estimator with finite positive variance and expected runtime T(F), its Monte Carlo efficiency is ϵ[F]:=1Var(F)T(F).
Sample Variance
Suppose that x1,,xN, with N2, and let x:=1Ni=1Nxi. The sample variance of x1,,xN is s2:=1N1i=1N(xix)2.
Inversion Method
Suppose that F is a cumulative distribution function that has an inverse F1, and suppose that Uunif[0,1]. The inversion method samples from F by setting X:=F1(U).

The inversion method is one way to turn a uniform random number into a random variable with a desired distribution. Start with U, which is uniformly distributed on [0,1]. If the desired cumulative distribution function is F, then the interval [0,F(x)] has length F(x), so P(UF(x))=F(x). Choosing X=F1(U) makes the event Xx match the event UF(x). Thus the transformation F1 reshapes uniform randomness so that the output X has distribution F.

Discrete Inversion Method
Suppose that x1,x2, are possible values with probabilities pi0 and ipi=1. Let Pi:=j=1ipj. If Uunif[0,1], the discrete inversion method returns xi when Pi1U<Pi, where P0:=0.
Discrete Inversion Method Has the Target Probabilities
Under the hypotheses of the discrete inversion method, P(X=xi)=pi.
The event {X=xi} is the event {Pi1U<Pi}. Since U is uniform on [0,1], the probability of this interval is its length: P(X=xi)=PiPi1=j=1ipjj=1i1pj=pi.
Inversion Method Samples from the Target Distribution
Suppose that F is an invertible cumulative distribution function, Uunif[0,1], and X=F1(U). Then X has cumulative distribution function F.
For any x, P(Xx)=P(F1(U)x). Since a cumulative distribution function is non-decreasing, applying F to both sides gives the equivalent event {UF(x)}. Because Uunif[0,1], P(F1(U)x)=P(UF(x))=F(x). Therefore the cumulative distribution function of X is F.

For example, suppose we want density p(x)=2x on [0,1]. Its cumulative distribution function is F(x)=x2. If U is uniform on [0,1], set X=U. Then P(Xx)=P(Ux)=P(Ux2)=x2, so X has density 2x. The random number generator only produced a uniform value; the transformation uu changed how often different output values occur.

Linear Function Density
Suppose that a,b[0,), not both 0, and define f:[0,1] by f(x)=(1x)a+xb. The normalized density proportional to f is p(x)=2f(x)a+b.
Inversion Sampling for a Linear Function Density
Under the hypotheses of linear function density, if Uunif[0,1], then a sample from density p is X=a(1U)a2+Ub2ab, when ab. Equivalently, to avoid cancellation, X=U(a+b)a+(1U)a2+Ub2.
The cumulative distribution function of p is F(x)=0x2((1t)a+tb)a+bdt=x(a(2x)+bx)a+b. Setting U=F(X) gives a quadratic equation in X. Solving the quadratic and choosing the root in [0,1] gives X=a(1U)a2+Ub2ab. Multiplying numerator and denominator by a+(1U)a2+Ub2 gives the equivalent form.
Change of Variables for Density Functions
Suppose that X is an n-dimensional random variable with density pX, and suppose that T:nn is a differentiable bijection whose Jacobian determinant is nonzero. If Y=T(X), then the density of Y is pY(y)=pX(T1(y))|det[DT(T1(y))]E|.
For every suitable set An, P(YA)=P(XT1(A))=T1(A)pX(x)dx. By the multivariable change of variables formula, with y=T(x), T1(A)pX(x)dx=ApX(T1(y))|det[DT(T1(y))]E|dy. Since this holds for every suitable A, the displayed integrand is the density of Y.
One Dimensional Density Transformation
Suppose that X has density pX, and T: is differentiable and one-to-one with T(x)0. If Y=T(X), then pY(y)=pX(T1(y))|T(T1(y))|.
This is the one-dimensional case of change of variables for density functions, where the Jacobian determinant is T.
Polar Coordinate Density Transformation
Under the polar coordinate map T(r,θ)=(rcosθ,rsinθ), pR,Θ(r,θ)=rpX,Y(rcosθ,rsinθ).
The absolute value of the Jacobian determinant of the polar coordinate map is r. Apply change of variables for density functions.
Spherical Coordinate Density Transformation
Under the spherical coordinate map T(r,θ,ϕ)=(rsinθcosϕ,rsinθsinϕ,rcosθ), pR,Θ,Φ(r,θ,ϕ)=r2sinθpX,Y,Z(T(r,θ,ϕ)).
The absolute value of the Jacobian determinant of the spherical coordinate map is r2sinθ. Apply change of variables for density functions.
Stratified Sampling
Suppose that a domain D is partitioned into disjoint measurable sets D1,,Dm. Stratified sampling is the practice of estimating an integral over D by taking samples separately within each stratum Di and combining the resulting estimates.
Stratified Monte Carlo Estimator
Suppose that D is partitioned into measurable strata D1,,Dm, with vi denoting the measure of Di. If Fi is a Monte Carlo estimator for 1viDif(x)dx, then the stratified Monte Carlo estimator is F:=i=1mviFi.
Stratified Sampling Does Not Increase Variance
Suppose that D is partitioned into measurable strata D1,,Dm, and samples are allocated proportionally to stratum measure: ni=viN. If μi and σi2 are the mean and variance of f under the uniform distribution on Di, and Q is the mean of f under the uniform distribution on D, then the stratified estimator has variance Var(F)=1Ni=1mviσi2, while the unstratified estimator has variance 1N(i=1mviσi2+i=1mvi(μiQ)2). Hence stratification does not increase variance.
For stratum Di, averaging ni independent samples gives variance σi2/ni by variance of an average of independent identically distributed random variables. The stratified estimator is F=iviFi, so independence of samples across strata gives Var(F)=i=1mvi2Var(Fi)=i=1mvi2σi2ni. Substituting ni=viN gives the displayed stratified variance.

For unstratified sampling, the total variance decomposes into the average within-stratum variance plus the variance of the stratum means:

Var(f(X))=i=1mviσi2+i=1mvi(μiQ)2. Averaging N independent samples divides this by N. Since each term vi(μiQ)20, the stratified variance is no larger.
Importance Sampling
Importance sampling estimates an integral Df(x)dx by drawing samples from a density p and using the weighted terms f(X)p(X). The density p should be positive wherever f is nonzero.

For example, to estimate 01x2dx, ordinary uniform sampling uses X[0,1] with density p(x)=1, so each weighted term is X2. Importance sampling could instead use the density p(x)=2x, which samples more often near 1, where x2 is larger. Then each weighted term is X2/(2X)=X/2, for samples X>0.

Ideal Importance Sampling Has Zero Variance for Nonnegative Integrands
Suppose that f:D[0,) and 0<Df(x)dx<. If p(x)=f(x)Df(t)dt, then each importance sampling term satisfies f(X)p(X)=Df(t)dt. Hence the Monte Carlo estimator has zero variance.
By the definition of p, f(X)p(X)=f(X)f(X)/Df(t)dt=Df(t)dt, whenever f(X)0. When f(X)=0, this value occurs only where the density also vanishes and does not affect the estimator. Thus the estimator is constant almost surely, and a constant random variable has variance 0.
Multiple Importance Sampling
Multiple importance sampling estimates an integral by combining samples drawn from several densities p1,,pm. If wi is a weight function for density pi, then a typical weighted term has the form wi(X)f(X)pi(X).
Multiple Importance Sampling Estimator
Suppose that p1,,pm are sampling densities and that Xi,j is sampled from pi, for 1jni. The multiple importance sampling estimator is F:=i=1m1nij=1niwi(Xi,j)f(Xi,j)pi(Xi,j).
Multiple Importance Sampling Unbiasedness Conditions
The multiple importance sampling estimator is unbiased for Df(x)dx if, whenever f(x)0, i=1mwi(x)=1, and wi(x)=0 whenever pi(x)=0.
Using linearity of expectation and the definition of density, E(F)=i=1mDwi(x)f(x)pi(x)pi(x)dx. The condition wi(x)=0 where pi(x)=0 makes the terms well-defined, and the remaining factors cancel: E(F)=Df(x)i=1mwi(x)dx=Df(x)dx.
Balance Heuristic
Suppose that p1,,pm are sampling densities and ni samples are drawn from pi. The balance heuristic assigns the weight wi(x):=nipi(x)jnjpj(x).
Balance Heuristic Weights Sum to One
If jnjpj(x)0, the balance heuristic weights satisfy i=1mwi(x)=1.
Substitute the definition: i=1mwi(x)=i=1mnipi(x)jnjpj(x)=inipi(x)jnjpj(x)=1.
Power Heuristic
Suppose that p1,,pm are sampling densities, ni samples are drawn from pi, and β+. The power heuristic assigns the weight wi(x):=(nipi(x))βj(njpj(x))β.
MIS Compensation
Given a density p and δ0, the MIS compensated density is p(x):=max(0,p(x)δ)Dmax(0,p(t)δ)dt, whenever the denominator is positive.
Russian Roulette Estimator
Suppose that X is an unbiased estimator for Q, and let B be a Bernoulli random variable with P(B=1)=q>0, independent of X. The Russian roulette estimator is Y:={X/qB=1,0B=0.
Russian Roulette Estimator is Unbiased
The Russian roulette estimator is unbiased: E(Y)=Q.
By conditioning on the two values of the Bernoulli random variable B, E(Y)=P(B=1)E(X/q)+P(B=0)E(0). Since P(B=1)=q and constants pull out of expectation, E(Y)=q1qE(X)=E(X). Since X is unbiased for Q, E(X)=Q.
Russian Roulette Estimator with a Fallback Value
Suppose that F is an estimator, q[0,1), c, and Uunif[0,1]. The Russian roulette estimator with fallback value is F:={Fqc1q,U>q,c,Uq.
Russian Roulette with a Fallback Value Preserves Expectation
Under the hypotheses of Russian roulette estimator with a fallback value, E(F)=E(F).
Since P(Uq)=q and P(U>q)=1q, E(F)=(1q)E(Fqc1q)+qc. Pulling constants out of expectation gives E(F)=E(F)qc+qc=E(F).
Splitting Estimator
Suppose that X1,,Xn are samples from a density pX, and for each Xi, the conditional samples Yi,1,,Yi,m are drawn from a conditional density pY|X(y|Xi). The splitting estimator for ABf(x,y)dydx is F:=1ni=1n1mj=1mf(Xi,Yi,j)pX(Xi)pY|X(Yi,j|Xi).
Splitting Estimator is Unbiased
Under the hypotheses of the splitting estimator, E(F)=ABf(x,y)dydx.
By linearity of expectation, E(F)=1ni=1n1mj=1mE(f(Xi,Yi,j)pX(Xi)pY|X(Yi,j|Xi)). For each i,j, use the joint density factorization p(x,y)=pX(x)pY|X(y|x): E(f(Xi,Yi,j)pX(Xi)pY|X(Yi,j|Xi))=ABf(x,y)pX(x)pY|X(y|x)pX(x)pY|X(y|x)dydx. The density factors cancel, so each summand has expectation ABf(x,y)dydx. Averaging nm identical expectations leaves that same integral.