Tutorials › Generalized Linear Models › Rate-Ratio Contrasts and Their Standard Errors

Count Effects and Predictions · Tutorial 473 of 981

Rate-Ratio Contrasts and Their Standard Errors

You will learn to form a rate-ratio contrast for two covariate profiles and calculate its standard error while accounting for coefficient covariances.

Intermediate 10 min read

What You'll Learn

  • Express the log rate ratio between two covariate profiles as a linear contrast of fitted coefficients.
  • Construct a contrast vector from a model’s design vectors.
  • Derive the variance and standard error of a coefficient contrast.
  • Use off-diagonal covariance terms when a contrast combines multiple coefficients.
  • Distinguish a rate ratio from an expected-count ratio when exposures differ.

From Coefficients to a Rate-Ratio Contrast

A fitted count model often describes effects on the log scale, while the scientific question is phrased as a comparison of rates. The link between these scales is precise: compare two covariate profiles by subtracting their linear predictors, then exponentiate the resulting coefficient contrast. To quantify uncertainty in that comparison, use the fitted covariance matrix of the coefficients—not just the separate standard errors of the coefficients involved.

Consider a Poisson log-mean model with a known positive exposure \(e_i\) for observation \(i\):

$$ \log E[Y_i\mid x_i]=\log(e_i)+x_i^T\beta. $$

Here \(Y_i\) is a count, \(x_i\) is its design vector, and \(\beta\) is the coefficient vector. The term \(\log(e_i)\) is an offset: its coefficient is fixed at one. The fitted rate, meaning the expected count per unit of exposure, is \(E[Y_i\mid x_i]/e_i\). Thus its log is \(x_i^T\beta\).

Definition: For two covariate profiles with design vectors \(x_A\) and \(x_B\), define the coefficient contrast \(c^T\beta=(x_A-x_B)^T\beta\), where \(c=x_A-x_B\). The rate ratio for profile \(A\) relative to profile \(B\) is \(\exp(c^T\beta)\). Its fitted value is \(\exp(c^T\hat{\beta})\).

This definition compares rates, not necessarily expected counts. If the profiles have different exposures, the ratio of their expected counts also includes the exposure ratio. The contrast vector is determined by the two profiles and the model’s design vectors; it can involve several coefficients, and the coefficient estimates may be correlated.

Why the Contrast Gives the Rate Ratio

Let \(\mu_A\) and \(\mu_B\) denote the conditional expected counts at the two profiles, with positive exposures \(e_A\) and \(e_B\). The model gives

$$ \frac{\mu_A/e_A}{\mu_B/e_B} = \frac{\exp(x_A^T\beta)}{\exp(x_B^T\beta)} = \exp\!\left((x_A-x_B)^T\beta\right). $$

The offsets disappear from this rate comparison because each expected count is divided by its own exposure. The intercept also cancels when the corresponding entries in \(x_A\) and \(x_B\) are both one. More generally, the subtraction of design vectors automatically cancels any components that are identical in the two profiles.

Worked Example: A Treatment Rate Ratio

Suppose the model has design vector \(x=(1,T,A)^T\), where \(T\) is zero for control and one for treatment, and \(A\) is age in years. Compare treatment and control at the same age. Let the fitted coefficients be \(\hat{\beta}=(1.2,0.40,0.03)^T\).

At a common age \(A=a\), the design vectors are \(x_A=(1,1,a)^T\) for treatment and \(x_B=(1,0,a)^T\) for control. Their difference is \(c=(0,1,0)^T\), so \(c^T\hat{\beta}=0.40\). The fitted rate ratio is

$$ \widehat{\mathrm{RR}}=\exp(0.40)=1.4918\ \text{(approximately)}. $$

Thus the fitted treatment rate is about 1.492 times the control rate at the same age. The intercept and age contribution cancel because those parts of the profiles are equal. This is a rate comparison; it does not require the two groups to have equal exposure.

Variance and Standard Error on the Log Scale

Write \(\hat{\beta}\) for the fitted coefficient vector and \(\widehat V\) for its fitted covariance matrix, with entries \(\widehat V_{jk}\). For a specified contrast \(c^T\beta\), the corresponding estimate is \(c^T\hat{\beta}\). If \(\operatorname{Cov}(\hat{\beta})=V\), the variance of this linear estimate is exactly \(c^T V c\). In routine model fitting, \(\widehat V\) is generally an estimate of the coefficient covariance matrix (often an estimated asymptotic covariance matrix), so the reported contrast variance is the plug-in estimate \(c^T\widehat Vc\).

Result: The estimated variance of the log rate-ratio estimate \(c^T\hat{\beta}\) is \(c^T\widehat Vc\). Its estimated standard error on the log scale is \(\sqrt{c^T\widehat Vc}\), provided this variance estimate is nonnegative.

To see the result, expand the contrast estimate as a sum of coefficient estimates. Linearity of expectation gives \(E[c^T\hat{\beta}]=c^TE[\hat{\beta}]\), and expanding the variance yields

$$ \begin{aligned} \operatorname{Var}(c^T\hat{\beta}) &=\operatorname{Var}\!\left(\sum_j c_j\hat{\beta}_j\right)\\ &=\sum_j\sum_k c_jc_k\operatorname{Cov}(\hat{\beta}_j,\hat{\beta}_k)\\ &=c^T Vc. \end{aligned} $$

Replacing \(V\) by its fitted estimate \(\widehat V\) gives the stated plug-in variance. Equivalently, for two coefficients \(j\) and \(k\), their contribution includes both diagonal variance terms and the covariance terms:

$$ c_j^2\widehat V_{jj}+c_k^2\widehat V_{kk} +2c_jc_k\widehat V_{jk}. $$

The covariance term can increase or decrease the contrast variance, depending on its sign and the contrast coefficients. The standard error just derived is for the log rate ratio \(c^T\hat{\beta}\). It is not the standard error of the exponentiated estimate; constructing intervals or standard errors on other scales requires additional methods.

Worked Example: A Rate Ratio Involving an Interaction

Suppose the fitted log-rate model is

$$ \log(\mu/e)=\beta_0+\beta_x x+\beta_z z+\beta_{xz}xz, $$

where \(x\) is an indicator and \(z\) is a continuous covariate. Compare \(x=1\) with \(x=0\) at \(z=2\). Let the coefficient ordering be \((\beta_0,\beta_x,\beta_z,\beta_{xz})\), with estimates \((0.1,0.7,-0.3,-0.1)\). The design-vector difference is \(c=(0,1,0,2)^T\). Therefore, the estimated log rate ratio is

$$ c^T\hat{\beta}=0.7+2(-0.1)=0.5, \qquad \widehat{\mathrm{RR}}=\exp(0.5)=1.6487\ \text{(approximately)}. $$

Suppose the fitted covariance matrix has \(\widehat V_{xx}=0.09\), \(\widehat V_{xz,xz}=0.04\), and \(\widehat V_{x,xz}=-0.015\). The other coefficients have contrast weight zero, so their covariance entries do not contribute. The contrast variance is

$$ \begin{aligned} c^T\widehat Vc &=1^2(0.09)+2^2(0.04)+2(1)(2)(-0.015)\\ &=0.09+0.16-0.06\\ &=0.19. \end{aligned} $$

The estimated standard error on the log scale is \(\sqrt{0.19}=0.4359\), approximately. Omitting the covariance term would instead give \(0.25\) for the variance, which is not the variance implied by the fitted covariance matrix. The interaction coefficient matters because the treatment-rate comparison depends on the specified value \(z=2\).

Working with Exposures and More General Contrasts

Contrasts are not limited to a single indicator coefficient. For any two specified profiles, form their design vectors using the model as fitted, subtract them in the stated order, and use the resulting vector for both the estimate and its variance. Reversing the order changes the sign of the log contrast and reciprocates the rate ratio; the contrast variance stays the same because \((-c)^T\widehat V(-c)=c^T\widehat Vc\).

The offset distinction is especially important when reporting count comparisons. If profile \(A\) has exposure \(e_A\) and profile \(B\) has exposure \(e_B\), then

$$ \frac{\mu_A}{\mu_B} = \frac{e_A}{e_B}\exp\!\left((x_A-x_B)^T\beta\right). $$

This is the ratio of expected counts. The rate ratio remains \(\exp((x_A-x_B)^T\beta)\). Exposure belongs in the expected-count ratio, but it is not an additional coefficient in the rate-ratio contrast when the offset is specified correctly.

Worked Example: Rate Ratio Versus Expected-Count Ratio

A Poisson model with exposure \(e\) uses \(\log E[Y\mid T,e]=\log(e)+\beta_0+\beta_1T\), where \(T=0\) is group B and \(T=1\) is group A. Suppose \(\hat{\beta}_1=0.36\), and the fitted variance for \(\hat{\beta}_1\) is \(0.0625\). Group A has exposure 250 and group B has exposure 100.

The group A-to-B rate-ratio estimate is \(\exp(0.36)=1.433329\ldots\), approximately \(1.433\). Its log-scale standard error is \(\sqrt{0.0625}=0.25\). The ratio of expected counts additionally includes the exposure ratio:

$$ \frac{\hat{\mu}_A}{\hat{\mu}_B} = \frac{250}{100}\exp(0.36) = 2.5(1.433329\ldots) = 3.583323\ldots \approx 3.583. $$

The fitted expected count in group A is therefore about 3.583 times that in group B, while the fitted rate in group A is about 1.433 times the rate in group B. The coefficient contrast and its standard error concern the log rate ratio; the exposure ratio changes the expected-count comparison, not that contrast.

Common Mistakes and a Reliable Calculation

  • Using a coefficient without checking the profiles. A coefficient alone represents the desired contrast only when the design-vector difference selects that coefficient. With interactions or other terms, calculate the difference explicitly.
  • Adding coefficient variances but dropping covariances. For a contrast involving multiple coefficients, use the full quadratic form \(c^T\widehat Vc\), including off-diagonal entries.
  • Calling a count ratio a rate ratio. When exposures differ, expected-count ratios include \(e_A/e_B\); rate ratios do not.
  • Calling the log-scale standard error the standard error of the rate ratio. The computed standard error applies to \(c^T\hat{\beta}\), before exponentiation.

A reliable calculation follows the same sequence each time: specify the two profiles and the target (rate or expected count), construct \(c=x_A-x_B\), calculate \(c^T\hat{\beta}\), and evaluate \(c^T\widehat Vc\). Check that the coefficient ordering in \(c\) matches the ordering in \(\hat{\beta}\) and \(\widehat V\). Only after these checks should the log contrast be exponentiated to report the fitted rate ratio.

Check Your Understanding

Use the model and covariance-matrix principles above to answer these questions.

  1. For profiles with design vectors \(x_A\) and \(x_B\), write the contrast vector and the fitted rate-ratio estimate.
  2. Why can a coefficient’s standard error alone be insufficient for the standard error of a rate-ratio contrast?
  3. If a contrast is \(2\hat{\beta}_1-\hat{\beta}_2\), write its estimated variance in terms of entries of \(\widehat V\).
  4. Two groups have exposures in a ratio of 4 to 1 and a fitted rate ratio of 1.5. What is their fitted expected-count ratio, with the numerator corresponding to the group with four times the exposure?
  5. When the order of two profiles is reversed, what happens to the log contrast, rate ratio, and contrast variance?
Clinical Biostats