Why Contrasts Need Their Own Uncertainty Calculation
A fitted log-link model reports estimates for coefficients, but rating questions often concern a combination of those estimates: a comparison between two levels, a policy-level indication, or a product of several fitted effects. The estimate of that combination is straightforward to calculate. Its uncertainty is not generally found by adding coefficient variances alone, because fitted coefficients can be correlated.
For example, a level-to-level comparison may be the difference between two coefficients. If the estimates move together across repeated samples, their difference can be more stable than either estimate on its own. If they move in opposite directions, the difference can be less stable. The covariance matrix captures this dependence. This tutorial shows how to use the full matrix and how to translate uncertainty from the log scale to the multiplicative scale.
Setting Up the Contrast and Covariance Calculation
First write the quantity of interest as a weighted sum of the fitted coefficients. The weights may be positive, negative, or greater than one. A comparison of two levels might use weights \(1\) and \(-1\); a combined indication might use several coefficients with weights determined by the intended combination of effects. Coefficients that do not contribute have weight zero.
For two coefficients, with variances \(V_{11}\), \(V_{22}\), and covariance \(V_{12}\), the calculation is
The covariance term has a factor of two because the full matrix product includes both the \((1,2)\) and \((2,1)\) entries. A covariance can be negative, and the contrast weights can also have opposite signs. Therefore, the covariance contribution may increase or decrease the contrast variance; its sign must be calculated rather than guessed.
The covariance matrix should correspond to the fitted model and coefficient parameterization being used. It may be a model-based covariance estimate or, where appropriate, a robust sandwich estimate. The formula does not make an incorrect model specification correct, and it is not appropriate to substitute standard errors for covariances: standard errors are square roots of diagonal variances, not off-diagonal matrix entries.
Why the Contrast Formula Holds
The contrast formula follows from the variance of a weighted sum. For two random quantities \(B_1\) and \(B_2\), expanding the centered square gives
For a coefficient vector, the same expansion includes every pair of coefficients and is written compactly as \(\mathbf{c}^{\mathsf T}\widehat{\boldsymbol{\Sigma}}\mathbf{c}\). The matrix notation is useful because it reduces the risk of omitting a covariance term when a contrast contains three or more coefficients.
To obtain uncertainty for the multiplicative indication \(R=\exp(C)\), use the delta method. If the coefficient estimates are approximately multivariate normal and the model is sufficiently regular for that approximation to be useful, then a first-order Taylor expansion of \(\exp(C)\) around the estimated contrast gives
Consequently, the approximate factor-scale standard error is \(\exp(\hat C)\sqrt{\widehat{\operatorname{Var}}(\hat C)}\). This is a local approximation, not an exact standard error for an exponentiated random estimate. It is most useful when the log-scale estimate is reasonably well approximated by a normal distribution and uncertainty is not so large that the local approximation is misleading. The covariance calculation on the log scale remains the key first step.
Worked Applications
Worked Example: Comparing Two Rating Levels
In a hypothetical fitted log-link model, two level coefficients are \(\hat{\beta}_1=0.12\) and \(\hat{\beta}_2=-0.04\). Their estimated covariance matrix is
Find the estimated level-1-to-level-2 multiplicative comparison, its log-scale variance, and its approximate factor-scale standard error. Use the contrast \(\hat{\beta}_1-\hat{\beta}_2\).
Method and contrast. The weight vector is \(\mathbf{c}=(1,-1)^{\mathsf T}\). The estimated log comparison is
Log-scale variance. The contrast variance includes the negative-weight covariance contribution:
Thus the log-scale standard error is \(\sqrt{0.0124}=0.111355\ldots\). The multiplicative comparison is \(\exp(0.16)=1.173510\ldots\), or 1.1735 to four decimal places. Using the unrounded values, the delta-method standard error is
to four decimal places. The comparison is therefore about 1.1735, with approximate factor-scale standard error 0.1307. The method avoids treating the two coefficient estimates as independent: their positive covariance reduces the variance of their difference.
Worked Example: A Combined Indication With Unequal Weights
A hypothetical policy-level indication combines two fitted effects as \(\hat C=\hat{\beta}_1+2\hat{\beta}_2\). Suppose \(\hat{\beta}_1=0.03\), \(\hat{\beta}_2=0.04\), and
Calculate the combined factor, its log-scale variance, and its approximate factor-scale standard error.
Method and estimate. The weights are \(\mathbf{c}=(1,2)^{\mathsf T}\). Therefore,
The combined factor is 1.1163 to four decimal places. For its variance, square each weight for the diagonal terms and include the covariance contribution:
The log-scale standard error is \(\sqrt{0.0109}=0.104403\ldots\). On the factor scale, the delta-method standard error is
to four decimal places. The result is a combined factor of 1.1163 with approximate standard error 0.1165. The covariance term is \(0.0020\), not \(0.0005\), because both off-diagonal entries in the matrix product contribute.
Worked Example: Combining Three Fitted Effects
For a hypothetical rating indication, suppose the fitted coefficients are \(\hat{\beta}_1=0.06\), \(\hat{\beta}_2=-0.02\), and \(\hat{\beta}_3=0.03\). The desired log indication is \(\hat C=\hat{\beta}_1+\hat{\beta}_2+2\hat{\beta}_3\), and the estimated covariance matrix is
Find the log indication, its variance, the multiplicative factor, and the factor-scale delta-method standard error.
Method and estimate. The contrast vector is \(\mathbf{c}=(1,1,2)^{\mathsf T}\). The estimate is
Variance using the full matrix. The diagonal contribution is \(0.0049+0.0036+4(0.0025)=0.0185\). The three distinct off-diagonal contributions, each counted twice, are
Hence \(\widehat{\operatorname{Var}}(\hat C)=0.0185+0.0008=0.0193\), and the log-scale standard error is \(\sqrt{0.0193}=0.138924\ldots\). The factor-scale standard error is
to four decimal places. The combined indication is 1.1052 with approximate standard error 0.1535. Keeping the two negative and positive covariance contributions separate makes the sign of each contribution transparent and helps prevent an arithmetic shortcut from changing the result.
Common Exam Trap: Dropping or Mis-signing Covariance
A frequent error is to treat coefficient estimates as independent merely because their individual standard errors are reported separately. Another is to use the covariance with the wrong sign when the contrast subtracts one coefficient. For a difference \(\hat{\beta}_1-\hat{\beta}_2\), the covariance contribution is \(-2\widehat{\operatorname{Cov}}(\hat{\beta}_1,\hat{\beta}_2)\); for a sum, it is \(+2\widehat{\operatorname{Cov}}(\hat{\beta}_1,\hat{\beta}_2)\).
For example, in the first worked example, an incorrect independence calculation would give \(0.0064+0.0100=0.0164\). The correct calculation is \(0.0064+0.0100-2(0.0020)=0.0124\). The incorrect result overstates the variance because the positive covariance makes the difference more stable. In other settings, omitting covariance can understate uncertainty, so it is not a reliably conservative shortcut.
A second trap is confusing the variance with the standard error. Compute the quadratic form first, then take its square root. Only after that should the delta-method factor \(\exp(\hat C)\) be applied. Do not exponentiate a variance, and do not multiply the factor by the log-scale variance when calculating a standard error.
Check Your Understanding
For each hypothetical fitted-model calculation, use the stated covariance and round final factors and standard errors to four decimal places.
- A level comparison is \(\hat{\beta}_1-\hat{\beta}_2\), with estimates \(0.07\) and \(0.02\), variances \(0.0081\) and \(0.0049\), and covariance \(0.0012\). Find the log-scale variance and multiplicative comparison. (Answer: variance \(0.0106\); factor \(\exp(0.05)=1.0513\).)
- A combined indication is \(\hat{\beta}_1+2\hat{\beta}_2\), with estimates \(0.03\) and \(0.04\), and covariance matrix \(\begin{pmatrix}0.0025&0.0005\\0.0005&0.0016\end{pmatrix}\). Find the log-scale variance and factor. (Answer: variance \(0.0109\); factor \(\exp(0.11)=1.1163\).)
- A hypothetical contrast is \(\hat{\beta}_1-\hat{\beta}_2\), with estimates \(0.08\) and \(0.03\), variances \(0.0100\) and \(0.0064\), and covariance \(-0.0020\). Find the log-scale variance and delta-method standard error of the factor. (Answer: variance \(0.0204\); factor-scale standard error \(\exp(0.05)\sqrt{0.0204}=0.1502\).)
- For weights \((1,-1,1)\), the coefficient estimates are \((0.02,0.01,0.04)\), and the covariance matrix is \(\begin{pmatrix}0.0036&0.0004&-0.0003\\0.0004&0.0025&0.0002\\-0.0003&0.0002&0.0049\end{pmatrix}\). Find the log contrast, its variance, the factor, and its delta-method standard error. (Answer: log contrast \(0.05\); variance \(0.0092\); factor \(1.0513\); standard error \(0.1008\).)
- A hypothetical two-coefficient indication is \(\hat{\beta}_1+\hat{\beta}_2\), with estimates \(0.04\) and \(0.06\), variances \(0.0040\) and \(0.0036\), and covariance \(-0.0010\). Calculate the variance and standard error first using the full covariance and then under an independence assumption. State the change in variance. (Answer: full variance \(0.0056\), full log-scale standard error \(0.0748\); independence variance \(0.0076\); full-covariance variance is \(0.0020\) lower.)