Why Transform Uniform Variates?
Simulation often starts with a source of uniform random numbers and transforms those numbers into draws from a model of interest. For a severity model, this lets an actuary generate hypothetical losses with a chosen distribution, then use those simulated losses in later calculations. The transformation must match the distribution’s parameters and the precise definition of those parameters.
The Weibull distribution is a flexible model for nonnegative quantities such as hypothetical insurance losses. Its shape parameter controls how probability is distributed across smaller and larger values, while its scale parameter sets the units and overall size. This tutorial derives the transformation, applies it to simulated losses, and checks the results against the distribution itself.
This tutorial uses \(k\) for shape and \(\lambda\) for scale throughout. A different source may use another symbol or a different parameterization, so check the cumulative distribution function before applying a sampling formula. In particular, the scale parameter here is not the reciprocal of a rate parameter.
Deriving the Inverse-Transform Formula
Let \(U\) be a uniform random variable on \((0,1)\). To obtain a Weibull random variable, set \(U=F_X(X)\) and solve for \(X\). For \(x\geq0\), the equation to invert is \(U=1-\exp[-(x/\lambda)^k]\).
\(1-U=\exp[-(x/\lambda)^k]\).
\(-\ln(1-U)=(x/\lambda)^k\). The left side is nonnegative because \(0<U<1\).
\(x=\lambda[-\ln(1-U)]^{1/k}\).
The justification is that, for \(x\geq0\), the transformation gives $$ P(X\leq x)=P\left(\lambda[-\ln(1-U)]^{1/k}\leq x\right) = P\left(U\leq 1-\exp[-(x/\lambda)^k]\right) =F_X(x). $$ The last equality uses the fact that \(P(U\leq u)=u\) for \(0\leq u\leq1\). Thus the transformed variable has exactly the target cumulative distribution function; the formula is not merely an approximation.
Because \(1-U\) is also uniform on \((0,1)\), \(X=\lambda[-\ln U]^{1/k}\) gives the same distribution. For a specified uniform input, however, the two formulas generally produce different individual values. Use the formula required by the problem, and do not mistake a different but distributionally equivalent input convention for a different Weibull model.
Worked Weibull Simulations
Worked Example: Transforming Three Uniform Variates
A hypothetical portfolio uses a Weibull severity model with scale \(\lambda=\$300\) and shape \(k=2\). One simulation run uses the uniform inputs \(U_1=1-e^{-0.25}\), \(U_2=1-e^{-1}\), and \(U_3=1-e^{-4}\). Find each simulated loss and the sample mean. Report money to the nearest cent.
Method. Apply \(X_j=300[-\ln(1-U_j)]^{1/2}\) to each input. The inputs correspond exactly to \(t=-\ln(1-U)\) values of \(0.25\), \(1\), and \(4\), respectively. Their approximate uniform values are \(0.2212\), \(0.6321\), and \(0.9817\).
For the first input, \(X_1=300(0.25)^{1/2}=300(0.5)=\$150\). For the second, \(X_2=300(1)^{1/2}=\$300\). For the third, \(X_3=300(4)^{1/2}=300(2)=\$600\).
The total is \(\$150+\$300+\$600=\$1{,}050\), so the sample mean is \(\$1{,}050/3=\$350\). The values check against the CDF: their transformed probabilities are \(1-e^{-0.25}\), \(1-e^{-1}\), and \(1-e^{-4}\), exactly the three specified uniform inputs. The common mistake avoided here is rounding the uniform inputs first and then treating them as exact; the stated exponential forms preserve the exact calculations.
Worked Example: Comparing Shape Parameters at the Same Input
A hypothetical simulator uses scale \(\lambda=\$800\) and receives the uniform input \(U=0.75\). Calculate the resulting loss for shape parameters \(k=1\), \(k=2\), and \(k=4\). Report to the nearest cent, and explain what the comparison does and does not show.
First, \(t=-\ln(1-U)=-\ln(0.25)=\ln 4\approx1.38629436\). The three transformed losses are:
For \(k=1\), \(X=800t=\$1{,}109.04\). For \(k=2\), \(X=800\sqrt{t}\approx800(1.17741002)=\$941.93\). For \(k=4\), \(X=800t^{1/4}\approx800(1.085085)=\$868.07\).
As a check, the \(k=2\) loss satisfies \((X/800)^2=t=\ln4\), so its cumulative probability is \(1-e^{-\ln4}=0.75\), the input uniform value. The same check holds for either other shape when its own transformed loss is substituted into its CDF.
With this fixed input, \(t>1\), so increasing \(k\) reduces \(t^{1/k}\) toward 1. This comparison is not a claim that a larger shape always gives a smaller loss for every uniform input: when \(0<t<1\), increasing \(k\) moves \(t^{1/k}\) upward toward 1. The common mistake is to describe the shape parameter as simply increasing or decreasing all simulated losses.
Interpreting Scale and Shape
The scale has a direct multiplicative effect. With \(k\) and \(U\) fixed, the factor \([-\ln(1-U)]^{1/k}\) does not change, so doubling \(\lambda\) doubles every transformed loss. The parameter also gives a useful distribution check: at \(x=\lambda\), $$ F_X(\lambda)=1-e^{-1}\approx0.6321. $$ Thus \(\lambda\) is the 63.21st percentile under this parameterization, not the mean or the median.
The shape affects the curvature of the distribution and the way losses change across uniform inputs. In particular, \(k=1\) gives \(F_X(x)=1-e^{-x/\lambda}\), an exponential distribution. For \(k>1\), the Weibull hazard rate increases with \(x\); for \(0<k<1\), it decreases. This follows by differentiating the cumulative hazard \(-\ln S_X(x)=(x/\lambda)^k\): the hazard is \(k x^{k-1}/\lambda^k\) for \(x>0\). For \(k=1\), it is constant. These properties describe the model; they do not guarantee that the model is appropriate for a particular portfolio.
Worked Example: Generating Losses and Checking a Threshold
A hypothetical severity model has scale \(\lambda=\$400\) and shape \(k=1.5\). For one simulation run, use \(U_1=1-e^{-0.125}\), \(U_2=1-e^{-1}\), and \(U_3=1-e^{-3.375}\). Generate the three losses, calculate their sample mean and the fraction above \(\$500\), then calculate the model probability that a loss exceeds \(\$500\).
Method. Since \(1/k=2/3\), each loss is \(400t^{2/3}\), where \(t=-\ln(1-U)\). The three \(t\) values are \(0.125\), \(1\), and \(3.375\). Their powers are \(0.125^{2/3}=0.25\), \(1^{2/3}=1\), and \(3.375^{2/3}=2.25\). Therefore the generated losses are \(\$100\), \(\$400\), and \(\$900\).
Their total is \(\$100+\$400+\$900=\$1{,}400\), giving a sample mean of \(\$1{,}400/3=\$466.67\) to the nearest cent. Only the \(\$900\) loss exceeds \(\$500\), so the fraction above the threshold in this three-value sample is \(1/3\).
The model probability is calculated from the survival function, not from the small sample fraction: $$ P(X>\$500)=\exp\left[-(500/400)^{1.5}\right] =\exp[-1.397542\ldots]\approx0.2472. $$ The generated losses check against their inputs because \((X/400)^{1.5}\) equals \(0.125\), \(1\), and \(3.375\), respectively; applying \(F_X\) therefore recovers each \(U_j\). The sample fraction \(1/3\) need not equal the model probability \(0.2472\), especially for a sample of only three values. The trap avoided is treating an observed sample proportion as if it had to equal the underlying probability.
Implementation Checks and Common Traps
A simulation routine should use independent uniform inputs when independent Weibull losses are required. Apply the same \(\lambda\) and \(k\) to each input only when the model specifies a common severity distribution. If the problem gives a different Weibull parameterization, rewrite its CDF in the form used here before transforming; formulas cannot safely be transferred by matching parameter names alone.
- Using the wrong exponent. The inverse has exponent \(1/k\), not \(k\). For example, with \(\lambda=300\), \(k=2\), and \(t=4\), the correct loss is \(300(4^{1/2})=\$600\). Using \(4^2\) instead gives \(\$4{,}800\), which does not invert the stated CDF.
- Confusing scale with shape. The scale \(\lambda\) has the units of the loss; the shape \(k\) does not. A loss expressed in dollars requires a scale in dollars.
- Mixing up a sample result and a model result. A simulated sample mean or fraction above a threshold is a statistic from that particular run. It is not, in general, exactly the model mean or exceedance probability.
- Ignoring numerical endpoints. The mathematical derivation takes \(0<U<1\). A computation of \(\ln(1-U)\) fails at \(U=1\); implementations should use a generator or endpoint convention that avoids taking the logarithm of zero.
Check Your Understanding
For each problem, use the scale-shape convention defined above. Give money to the nearest cent where relevant and probabilities to four decimal places.
- A hypothetical loss model has \(\lambda=\$500\), \(k=2\), and input \(U=0.36\). Find the simulated loss. (Answer: \(\$334.02\))
- A Weibull simulator has \(\lambda=\$250\), \(k=1.5\), and \(U=1-e^{-8}\). Find the simulated loss and state the corresponding value of \(-\ln(1-U)\). (Answer: \(-\ln(1-U)=8\), simulated loss \(=\$1{,}000\))
- A hypothetical model has \(\lambda=\$900\), \(k=3\), and \(U=1-e^{-0.008}\). Calculate the simulated loss and verify that substituting it into the CDF returns the input probability. (Answer: \(\$180\); \(F_X(180)=1-e^{-0.008}\approx0.0080\))
- For a Weibull model with \(\lambda=\$800\) and \(k=2\), calculate the probability that a loss exceeds \(\$1{,}200\). (Answer: \(0.1054\))
- Using the same input \(U=0.5\), compare the simulated losses for \(\lambda=\$600\) with \(k=1\) and \(k=2\). (Answer: \(k=1\) gives \(\$415.89\); \(k=2\) gives \(\$499.53\))