Tutorials › Generalized Linear Models › Prior Weights Across GLM Conventions

Offsets Weights and Trials · Tutorial 130 of 981

Prior Weights Across GLM Conventions

Distinguish the main meanings of prior weights and see how each convention changes the statistical model.

Intermediate 12 min read

What You'll Learn

  • Explain why “prior weight” has no universal statistical meaning across GLM software and texts.
  • Derive how integer frequency weights represent replicated observations.
  • Interpret variance weights as relative precision under a specified variance model.
  • Relate weighted binomial proportions to their numbers of trials.
  • Identify which parts of a weighted likelihood depend on the convention being used.
  • Check a weight’s meaning before interpreting a fitted model.

One Name, Several Meanings

A GLM program may accept a column called prior weights, but that label alone does not identify the statistical role of the numbers. Depending on the software, the family, and how the response is recorded, weights may encode replicated records, relative precision, or the number of binomial trials behind a reported proportion. These interpretations can produce similar-looking weighted calculations while describing different data-generating arrangements.

The word “prior” here means that the weights are supplied to the fitting procedure, rather than estimated as regression coefficients. It does not mean that they are Bayesian prior probabilities or prior distributions. The key question is what each weight says about the observations and the likelihood.

Definition: A prior weight is a nonnegative value supplied with an observation and used by a specified fitting convention to alter its contribution to a fitting criterion or likelihood. There is no universal interpretation that applies to every GLM family or software implementation. Its meaning must be read from the model specification and the relevant documentation.

Three interpretations occur often. A frequency weight says how many identical observation records are represented. A variance weight specifies relative precision through a variance model. A binomial trial total records how many Bernoulli outcomes produced a grouped number of successes or a sample proportion. The formulas can all involve multiplication by a weight, but the sampling statements behind them differ.

ConventionWhat the weight representsTypical model statement
FrequencyRepeated copies of the same observed recordThe record contributes its log-likelihood once per copy
Variance or precisionRelative observation precisionVariance is inversely proportional to the weight
Binomial trialsNumber of Bernoulli trials underlying a grouped responseThe response has a binomial distribution with that trial total

Frequency Weights: Counting Replicated Records

Suppose the data contain records \(i=1,\ldots,n\), and record \(i\) has response \(y_i\), covariates \(x_i\), and likelihood contribution \(f(y_i;\theta_i)\). If that exact record represents \(m_i\) independent copies, where \(m_i\) is a nonnegative integer, the joint likelihood is the product of the likelihood contributions for all copies.

Result: Under independent replication of record \(i\) exactly \(m_i\) times, its contribution to the log-likelihood is \(m_i\log f(y_i;\theta_i)\). Thus the full log-likelihood for the replicated data is \(\sum_i m_i\log f(y_i;\theta_i)\).

To verify this, label the copies \(j=1,\ldots,m_i\). Conditional on the model parameters, independence gives a likelihood contribution \(\prod_{j=1}^{m_i} f(y_i;\theta_i)=f(y_i;\theta_i)^{m_i}\). Taking logarithms gives \(m_i\log f(y_i;\theta_i)\). Multiplying across records and taking logarithms yields the stated sum. The formula is exact when the rows really stand for identical replicated observations, not merely because a column of numbers has been supplied as weights.

Worked Example: A Frequency Weight for Bernoulli Records

Suppose a Bernoulli model has a common success probability \(p\). The observed records are \(1,0,1\), with frequency weights \(3,2,1\), respectively. Interpret each weight as the number of independent copies of that record.

The expanded data contain three successes from the first record, two failures from the second, and one success from the third. There are therefore four successes and two failures. The likelihood, omitting no parameter-dependent terms, is

$$ L(p)=p^3(1-p)^2p=p^4(1-p)^2,\qquad 0<p<1. $$

The log-likelihood is \(\ell(p)=4\log p+2\log(1-p)\). Its derivative is \(4/p-2/(1-p)\). Setting this equal to zero gives \(4(1-p)=2p\), hence \(\hat p=2/3\). This is also the observed proportion \(4/6\) in the expanded data. The calculation relies on the weights being replication counts.

Variance Weights: Relative Precision

A variance-weight convention instead describes how the conditional variance changes across observations. For a Gaussian model with means \(\mu_i\), a common specification is

$$ Y_i\ \text{independent},\qquad E[Y_i]=\mu_i,\qquad \operatorname{Var}(Y_i)=\frac{\phi}{w_i}, $$

where \(\phi>0\) is a common scale parameter and \(w_i>0\) is a known precision multiplier. A larger \(w_i\) means smaller variance: doubling \(w_i\) halves \(\operatorname{Var}(Y_i)\). In a more general GLM variance convention, the corresponding specification may be \(\operatorname{Var}(Y_i)=\phi V(\mu_i)/w_i\), where \(V\) is the variance function. The convention and family determine which formula is intended.

For the Gaussian model with known \(\phi\), the log-likelihood, apart from constants independent of the means, is

$$ \ell(\mu_1,\ldots,\mu_n) =-\frac{1}{2\phi}\sum_{i=1}^n w_i(y_i-\mu_i)^2+\text{terms not depending on the means}. $$

This follows from the normal density: the quadratic term for observation \(i\) is \(-(y_i-\mu_i)^2/(2\operatorname{Var}(Y_i))\), and substituting \(\operatorname{Var}(Y_i)=\phi/w_i\) gives \(-w_i(y_i-\mu_i)^2/(2\phi)\). The density also has a normalizing term involving the variance; when \(w_i\) and \(\phi\) are fixed, that term does not depend on \(\mu_i\). Thus a mean model is fitted by minimizing a weighted sum of squared residuals. This does not turn each observation into \(w_i\) replicated responses.

Worked Example: A Gaussian Variance Weight

Let \(Y_1=2\) and \(Y_2=8\), and suppose both have unknown common mean \(\mu\). Let \(\phi=1\), with known variance weights \(w_1=3\) and \(w_2=1\). The specified variances are \(1/3\) and \(1\), respectively.

Up to terms that do not depend on \(\mu\), the log-likelihood is \(-\tfrac12\{3(2-\mu)^2+(8-\mu)^2\}\). Maximizing it is equivalent to minimizing

$$ Q(\mu)=3(2-\mu)^2+(8-\mu)^2. $$

Differentiate: \(Q'(\mu)=6(\mu-2)+2(\mu-8)=8\mu-28\). Setting this to zero gives \(\hat\mu=28/8=3.5\). The second derivative is \(Q''(\mu)=8>0\), so this is the unique minimum. Equivalently, \(\hat\mu=(3\cdot2+1\cdot8)/(3+1)=3.5\). The first observation receives more influence because the model assigns it lower variance; the weight is not a count of copies.

Binomial Trial Totals: Weights Attached to Proportions

In grouped binomial data, a row may report a proportion rather than a success count. If \(S_i\) successes are observed in \(n_i\) Bernoulli trials, the reported proportion is \(r_i=S_i/n_i\). A software convention may accept \(r_i\) as the response and \(n_i\) as a prior weight. In that setting the weight identifies the binomial denominator: \(S_i=n_i r_i\) must be a valid integer success count for the ordinary grouped-binomial model.

If the success probability for row \(i\) is \(p_i\), then \(S_i\sim\operatorname{Binomial}(n_i,p_i)\). Its likelihood contribution is

$$ \binom{n_i}{S_i}p_i^{S_i}(1-p_i)^{n_i-S_i}. $$

Using \(r_i=S_i/n_i\), the parameter-dependent part of the log-likelihood is \(n_i\{r_i\log p_i+(1-r_i)\log(1-p_i)\}\). The trial total multiplies the response’s contribution because there are \(n_i\) Bernoulli trials summarized by that proportion. It is not just a generic instruction to increase a row’s importance.

Worked Example: Proportions With Different Trial Totals

Two groups share a common success probability \(p\). Group 1 has 8 successes in 10 trials, so its proportion is \(0.8\); group 2 has 1 success in 2 trials, so its proportion is \(0.5\). Represent the proportions with trial-total weights 10 and 2.

The combined success count is \(8+1=9\), and the combined trial count is \(10+2=12\). The likelihood is

$$ L(p)=\binom{10}{8}\binom{2}{1}p^9(1-p)^3. $$

The binomial coefficients do not depend on \(p\), so the score for \(p\) is \(9/p-3/(1-p)\). Setting it to zero gives \(9(1-p)=3p\), so \(\hat p=9/12=0.75\). The same parameter-dependent log-likelihood follows from the weighted proportions: \(10\{0.8\log p+0.2\log(1-p)\}+2\{0.5\log p+0.5\log(1-p)\}\). Its coefficients are \(9\) for \(\log p\) and \(3\) for \(\log(1-p)\), as required. The weights here are specifically the numbers of trials.

Reading a Software Convention Carefully

Different implementations may use the same argument name for different purposes, or interpret it differently by response family. For example, documentation may describe weights for a binomial proportion as trial totals, while describing weights for other families as prior precision or dispersion multipliers. Another text may use “frequency weight” for literal replicated records. These statements need not conflict: they describe different conventions.

Before fitting or interpreting a model, establish the following from the model specification and documentation:

  • Whether the response is an individual observation, a replicated record, a binomial count, or a proportion.
  • Whether the weight is a replication count, a variance multiplier, a trial total, or another explicitly defined quantity.
  • Whether the documented likelihood is an ordinary sampling likelihood or a weighted fitting criterion.
  • Whether the family and response format impose restrictions, such as integer trial totals for grouped binomial data.

A useful check is to ask what happens if a weight is doubled. Under frequency weighting, this means the record occurs twice as often in the expanded data. Under the variance convention above, it halves the observation’s variance. For a binomial proportion it doubles the number of trials underlying that proportion. Those are distinct claims, even when all three lead to a larger numerical contribution in some calculation.

Common Mistake: Treating Every Weight as a Replication Count

A common but incorrect argument is: “The software multiplies an observation’s contribution by \(w_i\), so \(w_i\) must mean that the observation was recorded \(w_i\) times.” Multiplication alone does not establish that interpretation. The same algebraic factor can arise from an independent-replication likelihood, from a variance model, or from a grouped binomial likelihood. The correction is to identify the assumed sampling model first, then interpret the weight according to that model and the software’s documented convention.

This distinction matters because weights are not interchangeable labels. Treating a variance multiplier as a count changes the implied data, and treating a binomial denominator as generic importance weighting obscures the number of trials and successes. The correct interpretation is part of the statistical model, not a cosmetic property of the data table.

Key takeaway: “Prior weight” names an input, not a universal model component. Frequency weights count replicated records; variance weights encode relative precision under a variance specification; binomial weights may record trial totals for proportions. State the convention before interpreting a weighted fit.

Check Your Understanding

For each question, identify the model interpretation that justifies the weight rather than relying on the word “weight” alone.

  1. A Bernoulli record with response 0 has frequency weight 4. How many failures does it represent in an expanded data set?
  2. Under \(\operatorname{Var}(Y_i)=\phi/w_i\), what happens to the variance when \(w_i\) is multiplied by 3?
  3. A reported binomial proportion is 0.6 with trial-total weight 5. Is it consistent with an integer success count? If so, how many successes?
  4. Why does a likelihood contribution multiplied by a number not, by itself, prove that the number is a frequency weight?
  5. What information should be checked before interpreting a software argument called “prior weights”?
Clinical Biostats