Tutorials › Generalized Linear Models › Worked Comparisons of Offsets and Weight Types

Offsets Weights and Trials · Tutorial 138 of 981

Worked Comparisons of Offsets and Weight Types

Learn to distinguish these model components by what they mean, how they enter the likelihood, and how they change estimates and standard errors.

Intermediate 12 min read

What You'll Learn

  • Interpret a Poisson exposure offset as a fixed coefficient of one on log exposure.
  • Calculate and interpret a group rate contrast with and without an exposure offset.
  • Use binomial trial totals to calculate logistic coefficients and their information.
  • Show when integer frequency weights reproduce replicated observations.
  • Compare frequency and variance weights through Gaussian estimates and standard errors.
  • Diagnose why similar fitted coefficients do not imply equivalent uncertainty.

Why These Comparisons Matter

In a generalized linear model, several quantities can affect a fit without playing the same role. An exposure offset fixes a known contribution to the linear predictor. A binomial trial total describes how many Bernoulli outcomes contribute to an observation. A frequency weight represents repeated observations, while a variance weight expresses relative precision. Confusing these meanings can leave a coefficient looking plausible while changing its interpretation, likelihood, or standard error.

The comparisons below focus on what each quantity means in a model and what follows from that meaning. For the worked uncertainty calculations, standard errors are model-based; the Gaussian examples state explicitly how dispersion is estimated.

Offsets: Fixing Exposure at Coefficient One

For a Poisson count \(Y_i\) observed over known exposure \(t_i>0\), a log-rate model can be written \( \log E[Y_i]=\log(t_i)+\beta_0+\beta_1 x_i \). The offset is \(\log(t_i)\): its coefficient is fixed at one rather than estimated. Exponentiating gives \( E[Y_i]=t_i\exp(\beta_0+\beta_1 x_i) \), so the linear predictor after removing exposure describes the log rate per exposure unit.

Definition: An offset is a known term included in a model's linear predictor with its coefficient fixed, not estimated. In a log-rate Poisson model, \(\log(t_i)\) is an offset when expected count is proportional to known exposure \(t_i\).

For a group indicator \(x_i\in\{0,1\}\), the coefficient \(\beta_1\) is the log ratio of the two expected rates, and \(\exp(\beta_1)\) is their rate ratio. Omitting the offset instead models expected counts directly. If exposure differs between groups, that is a different model and generally answers a different question.

Worked Example: Comparing Count Ratios and Rate Ratios

Suppose group A has 12 events over 3 person-years, and group B has 20 events over 5 person-years. Use a Poisson model with a group indicator to compare the fitted contrast with and without an exposure offset.

With the offset: the group-specific fitted rates are \(12/3=4\) and \(20/5=4\) events per person-year. Thus the fitted log rate ratio is \( \hat\beta_1=\log(4/4)=0 \), and the fitted rate ratio is \(\exp(0)=1\). The group-specific log rates are both \(\log 4\).

For independent Poisson counts in two groups, the model-based variance of the difference of fitted log rates is \(1/Y_A+1/Y_B\). Here it is \(1/12+1/20=5/60+3/60=8/60=2/15\), so the standard error of the log rate ratio is \(\sqrt{2/15}\approx0.365\).

Without the offset: a model for counts has fitted group means 12 and 20, so its fitted log count ratio is \( \log(20/12)=\log(5/3)\approx0.511 \). This is not the fitted rate ratio: it compares counts accumulated over different exposures. The data have equal fitted rates, but unequal counts precisely because the exposures are unequal.

Binomial Trial Totals: Information From Repeated Trials

For grouped binomial data, an observation records \(S_i\) successes out of \(n_i\) trials. Under a logistic model, \(S_i\sim\operatorname{Binomial}(n_i,p_i)\) and \( \operatorname{logit}(p_i)=\eta_i \). The total \(n_i\) is part of the sampling distribution: it determines how much information that group contributes about \(p_i\). A proportion \(S_i/n_i\) alone does not say whether it came from a few trials or many.

Key distinction: A binomial trial total is not a generic weight. It specifies the number of Bernoulli trials underlying a binomial response. Its effect on uncertainty follows from the binomial likelihood and variance \(n_i p_i(1-p_i)\).

Worked Example: A Logistic Contrast With Different Trial Totals

Group A has 8 successes in 10 trials, and group B has 18 successes in 30 trials. Fit a logistic model with an intercept and an indicator for group B.

The fitted proportions are \(\hat p_A=8/10=0.8\) and \(\hat p_B=18/30=0.6\). The fitted intercept is the log odds for group A: \( \hat\beta_0=\log(0.8/0.2)=\log 4\approx1.386 \).

The group coefficient is the difference in fitted log odds: \( \hat\beta_1=\log(0.6/0.4)-\log(0.8/0.2)=\log(1.5)-\log(4)=\log(0.375)\approx-0.981 \). Thus the fitted odds in B are \(0.375\) times the fitted odds in A.

For this two-group model, the estimated variance of the log-odds contrast is \(1/8+1/2+1/18+1/12\). These terms are the reciprocals of the fitted success and failure counts in each group. In common denominators, \(1/8+1/2+1/18+1/12=45/360+180/360+20/360+30/360=275/360\approx0.764\). The standard error is therefore \(\sqrt{0.764}\approx0.873\).

If the proportions were incorrectly treated as just one Bernoulli observation per group, the fitted proportions—and therefore the fitted log-odds contrast—would still be 0.8 and 0.6. But the corresponding variance calculation would be \(1/[0.8(0.2)]+1/[0.6(0.4)]=6.25+4.167=10.417\), giving a standard error of about 3.227. That calculation discards the actual trial totals and does not represent the grouped binomial sampling model.

Frequency Weights and Variance Weights

An integer frequency weight \(m_i\) means that the observation represents \(m_i\) records with the same response and covariates. Its log-likelihood contribution is multiplied by \(m_i\), just as it would be if those records were written out individually. A variance weight has a different interpretation. In a common Gaussian model, a known relative precision weight \(w_i>0\) means that observation \(i\) has variance \(\sigma^2/w_i\). It changes how precisely that observation informs the fit; it does not assert that the observation occurred \(w_i\) times.

Theorem: If a record with response \(y_i\) and covariates \(x_i\) is repeated \(m_i\) times, where \(m_i\) is a nonnegative integer, its total log-likelihood contribution is \(m_i\ell_i(\theta)\). Consequently, using \(m_i\) as a frequency weight gives the same likelihood-based coefficient estimates and information as explicitly listing those repeated records, provided the model and likelihood contributions are otherwise identical.

Proof. Let \(f(y_i\mid x_i;\theta)\) be the likelihood contribution from one record. The \(m_i\) identical records contribute \( \prod_{j=1}^{m_i} f(y_i\mid x_i;\theta)=f(y_i\mid x_i;\theta)^{m_i} \). Taking logarithms gives \(m_i\log f(y_i\mid x_i;\theta)=m_i\ell_i(\theta)\). Summing over records produces the frequency-weighted log-likelihood. Its derivatives with respect to \(\theta\), including the score and information, are therefore the same as those from the expanded data. For a Gaussian model, dispersion estimates also depend on the correct residual degrees of freedom for the expanded sample. \(\square\)

Worked Example: Same Weighted Mean, Different Uncertainty

Consider two responses, \(y_1=0\) and \(y_2=10\), with weights 1 and 3. Compare treating the weights as frequency weights with treating them as relative precision weights in a Gaussian intercept-only model.

Coefficient estimate in either case: the weighted mean is \( \hat\mu=(1\cdot0+3\cdot10)/(1+3)=30/4=7.5 \). Thus the point estimate alone does not distinguish the meanings of the weights.

Frequency-weight interpretation: the expanded sample is \(0,10,10,10\). Its squared deviations from 7.5 sum to \( (0-7.5)^2+3(10-7.5)^2=56.25+3(6.25)=75 \). There are four records and one fitted mean, so the residual degrees of freedom are \(4-1=3\). The usual unbiased residual variance estimate is \(75/3=25\). The estimated standard error of the mean is \(\sqrt{25/4}=2.5\).

Variance-weight interpretation: the two independent records have variances \(\sigma^2/1\) and \(\sigma^2/3\). The weighted residual sum of squares is still \(75\), but there are only two records and one fitted mean; using residual degrees of freedom \(2-1=1\) gives \(\hat\sigma^2=75\). The standard error of the weighted mean is then \(\sqrt{\hat\sigma^2/(1+3)}=\sqrt{75/4}\approx4.330\). The coefficient is identical, but the estimated uncertainty differs because the weights describe different data-generating structures.

A Rate-Model Result for Exposure

The effect of an offset can also be seen directly from the likelihood. Suppose independent counts satisfy \(Y_i\sim\operatorname{Poisson}(t_i\lambda)\), with known \(t_i>0\) and a common unknown rate \(\lambda=\exp(\beta)\). This is an intercept-only log-rate model with offset \(\log(t_i)\).

Result: In this model, the maximum likelihood estimate of the common rate is total events divided by total exposure: \( \hat\lambda=\sum_iY_i/\sum_i t_i \).

Derivation. Ignoring terms that do not depend on \(\beta\), the log-likelihood is \( \ell(\beta)=\sum_i[Y_i(\log t_i+\beta)-t_i\exp(\beta)-\log(Y_i!)] \). Its score and second derivative are \( \ell'(\beta)=\sum_iY_i-\exp(\beta)\sum_i t_i \) and \( \ell''(\beta)=-\exp(\beta)\sum_i t_i<0 \). The score is zero exactly when \( \exp(\hat\beta)=\sum_iY_i/\sum_i t_i \), and the negative second derivative shows this is the unique maximum. Therefore \(\hat\lambda=\exp(\hat\beta)=\sum_iY_i/\sum_i t_i\). The offset is what makes total exposure, rather than the number of records, the denominator of the fitted rate. \(\square\)

Worked Example: Pooling Counts With Unequal Exposure

Suppose three clinics record 6 events over 2 units of exposure, 15 over 5, and 9 over 3. Under a common-rate Poisson model with the log exposures as offsets, total events are \(6+15+9=30\), and total exposure is \(2+5+3=10\). The fitted common rate is therefore \(30/10=3\) events per exposure unit. The fitted expected counts are \(2(3)=6\), \(5(3)=15\), and \(3(3)=9\), matching the observed counts in this particular data set.

How to Choose the Right Interpretation

Before interpreting coefficients or standard errors, ask what the quantity attached to each record represents. Exposure belongs in a log-rate model when expected counts scale proportionally with known time, area, or another exposure measure. A binomial total belongs in the response distribution when successes are counted out of known trials. A frequency weight represents replicated records. A variance weight represents relative precision under a stated variance model.

These meanings can yield similar coefficient estimates while implying different uncertainty. For example, the weighted mean in the Gaussian example is the same under both weight interpretations, but the replication structure and estimated dispersion differ. The binomial example shows a parallel warning: the observed proportions determine the fitted group logits, but the trial totals determine the information supporting them.

Common Mistake

  • Wrong reasoning: “The model accepts a weight column, so I can put exposure, trial totals, replication counts, or precision values into that column interchangeably.”
  • Correction: A model's weight argument does not define the scientific meaning of its input. Specify whether the quantity is an offset, a binomial trial total, a frequency count, or a variance weight, then use a likelihood and uncertainty calculation that match that interpretation.
  • Another warning: Do not infer equivalence from matching point estimates. Check the likelihood contributions and the standard-error calculation as well.
Key takeaway: Offsets fix known linear-predictor contributions; binomial totals count trials; frequency weights replicate likelihood contributions; and variance weights encode relative precision. Their interpretations—not their appearance in software—determine fitted uncertainty.

Check Your Understanding

For each question, explain both the model meaning and its consequence for estimation or uncertainty.

  1. A Poisson count is observed over ten times as much exposure as another count. What term belongs in a log-rate model, and what is its coefficient?
  2. Why can two groups have different event counts but the same fitted rate ratio of one?
  3. Two grouped binomial observations have the same observed success proportion but different trial totals. Why should their information differ?
  4. When does an integer frequency weight reproduce explicitly replicated records?
  5. In the Gaussian example, why did the two interpretations of weights give the same fitted mean but different standard errors?
Clinical Biostats