Why the Meaning of a Weight Depends on the Model
In R, the weights argument to glm() supplies prior weights for observations. A weight changes how strongly an observation contributes to fitting; it does not alter the recorded response or predictor values. The key question is why the observation should receive that amount of influence. The answer depends on the response family, the data representation, and the reason the weights were chosen.
For instance, a Gaussian model can use weights to represent differences in observation-level precision. In a binomial model, weights can have a trial-count interpretation when the response is recorded as a proportion. In other uses, weights may simply define a weighted likelihood that emphasizes selected observations. These interpretations are not interchangeable. A weight of 5 does not automatically mean five times as much exposure, five replicated records, or five trials.
In R, the argument is supplied in a call such as glm(y ~ x, family = gaussian(), weights = w, data = d). If it is omitted, each observation has weight 1. This user-supplied vector is also called the prior weights in the fitted model object. Do not confuse it with the working weights that the GLM fitting algorithm calculates internally during iterative fitting; working weights are part of the numerical procedure, not a replacement for the weights argument.
How Weights Enter the Fit
The weighted-likelihood expression explains the basic effect: the fitting procedure seeks parameter values that give a good fit to observations in proportion to their weights. For a given model and response family, increasing one observation's weight increases the impact of its likelihood contribution relative to the others. It does not guarantee that the fitted value for that observation will match its response exactly, particularly when the model must balance many observations using a limited set of coefficients.
For a Gaussian GLM with identity link, a common model-based interpretation is that observations have different variances. Suppose \(Y_i \sim N(\mu_i,\phi/w_i)\), independently, with \(w_i>0\), and \(\phi\) a common dispersion parameter. Then larger \(w_i\) means smaller variance and greater precision. This interpretation depends on that variance specification; it is not automatically appropriate for every Gaussian analysis.
For other families, the meaning follows from their likelihood and the response format. In a Poisson model, prior weights multiply the observation's Poisson log-likelihood contribution. In a binomial model, weights for a proportion response can represent the number of trials behind that proportion; weights applied to binary rows can instead define a weighted contribution for each row. The response representation matters, so the same numeric weight need not have the same substantive meaning across models.
Worked Example: Gaussian Weights as Relative Precision
A hypothetical analyst fits an intercept-only Gaussian model to three measurements, \(y=(10,14,20)\), with prior weights \(w=(1,2,1)\). Assume independent observations with \(Y_i\sim N(\mu,\phi/w_i)\), where \(\phi\) is unknown and common. Find the fitted mean, compare it with the unweighted mean, and explain the role of the second weight.
Method. Under the stated Gaussian variance model, maximizing the weighted likelihood for the common mean is equivalent to minimizing the weighted sum of squared residuals: $$ Q(\mu)=\sum_i w_i(y_i-\mu)^2 =(10-\mu)^2+2(14-\mu)^2+(20-\mu)^2. $$
Differentiate with respect to \(\mu\) and set the derivative to zero: $$ \frac{dQ}{d\mu} =-2\sum_i w_i(y_i-\mu)=0, \qquad \widehat{\mu}=\frac{\sum_i w_i y_i}{\sum_i w_i}. $$
Substitute the values. The weighted response total is \(1(10)+2(14)+1(20)=10+28+20=58\). The total weight is \(1+2+1=4\). Therefore \(\widehat{\mu}=58/4=14.5\). The ordinary mean is \((10+14+20)/3=44/3\), or approximately \(14.667\). The second observation pulls the fitted mean toward 14 more strongly than either other observation.
Check. At \(\mu=14.5\), the weighted residuals sum to \(1(-4.5)+2(-0.5)+1(5.5)=-4.5-1+5.5=0\), as required by the intercept-only estimating condition. The common mistake is to treat the weight 2 as changing the measurement from 14 to 28. It changes the observation's influence, not its recorded value.
Family and Response Representation Matter
A prior weight is not a universal declaration of “importance” with a single statistical interpretation. The family specifies the observation-level likelihood, and the response format specifies what one row represents. Together, these determine how a weight enters the fit.
| Fit and response representation | Possible meaning of a prior weight | Interpretive caution |
|---|---|---|
| Gaussian response with a specified variance model | Relative precision; often \(Y_i\) has variance \(\phi/w_i\) | Use this interpretation only when the variance assumption is appropriate. |
| Poisson response | Multiplier on the row's Poisson log-likelihood contribution | It is not automatically an exposure amount or an exposure offset. |
| Binomial proportion response | May represent the number of trials underlying the proportion | Check that the response format and weights consistently describe those trials. |
| Binary response, one row per recorded outcome | Multiplier on that row's Bernoulli likelihood contribution | Do not assume a chosen weight means a particular number of trials or replicated records. |
The table gives common interpretations, not permission to choose weights after seeing which fit is preferred. The analyst should be able to explain what each weight represents and why that interpretation matches the data. For example, known exposure in a rate model is usually represented through the model's rate structure, often with a log-exposure offset, rather than by silently treating exposure as a generic prior weight.
Worked Example: Weighted Binary Outcomes
A hypothetical insurer studies whether a policyholder files at least one claim during a specified period. Four independent binary outcomes are \(y=(1,0,1,0)\), where 1 denotes a claim. The analyst fits an intercept-only binomial GLM with prior weights \(w=(1,2,3,1)\), treating them as row-level likelihood multipliers. Find the fitted claim probability and the intercept. Do not interpret these weights as trial counts.
Method. Let \(p\) be the common probability of a claim. The weighted Bernoulli log likelihood, excluding constants, is $$ \ell_w(p)=\sum_i w_i\{y_i\log(p)+(1-y_i)\log(1-p)\}. $$ The total weight on outcomes equal to 1 is \(1(1)+2(0)+3(1)+1(0)=4\). The total weight is \(1+2+3+1=7\), so the weight on outcomes equal to 0 is \(7-4=3\). Thus $$ \ell_w(p)=4\log(p)+3\log(1-p). $$
Differentiate and set the result to zero: $$ \frac{d\ell_w}{dp}=\frac{4}{p}-\frac{3}{1-p}=0. $$ Multiplying by \(p(1-p)\) gives \(4(1-p)-3p=0\), so \(4-7p=0\) and \(\widehat p=4/7\approx0.5714\). With the logit link, the fitted intercept is \(\log\{\widehat p/(1-\widehat p)\}=\log\{(4/7)/(3/7)\}=\log(4/3)\approx0.2877\).
Check. The fitted odds are \(4/3\), matching the weighted claim total divided by the weighted non-claim total. The common mistake is to call the weight 3 on the third row “three trials” without a data-collection basis for that interpretation. Here it was defined as a row-level likelihood multiplier.
Worked Example: Poisson Weights Are Not Exposure Offsets
A hypothetical portfolio extract contains three Poisson counts \(y=(0,2,4)\). An analyst fits an intercept-only Poisson GLM with prior weights \(w=(1,3,1)\). Assume independent Poisson outcomes with a common mean \(\lambda\), and treat the weights as likelihood multipliers. Calculate \(\widehat\lambda\), then explain why the weight 3 cannot by itself be read as exposure of three units.
Method. For a Poisson observation, the log likelihood apart from terms not involving \(\lambda\) is \(y_i\log(\lambda)-\lambda\). Therefore the weighted log likelihood is $$ \ell_w(\lambda)=\left(\sum_i w_i y_i\right)\log(\lambda)-\left(\sum_i w_i\right)\lambda+\text{constant}. $$ Here \(\sum_i w_i y_i=1(0)+3(2)+1(4)=10\), and \(\sum_i w_i=1+3+1=5\). Differentiating gives \(10/\lambda-5=0\), hence \(\widehat\lambda=10/5=2\). The log-link intercept is \(\log(2)\approx0.6931\).
Check. The fitted mean equals the weighted count total divided by the total weight, \(10/5=2\). An exposure offset would instead put a known exposure amount into the linear predictor for the expected count. The prior weight here multiplies a likelihood contribution; without an explicit data definition, it does not establish that the second row had three units of exposure. The common mistake is to infer exposure from the numeric weight alone.
What Weighted Fitting Emphasizes
Weighted fitting emphasizes observations through their contribution to the fitted objective, but the exact consequence depends on the model. The Gaussian example showed that a more precise observation has a stronger pull on a common fitted mean. The binary and Poisson examples showed weighted likelihood calculations: the fitted intercept-only mean balances weighted response contributions against total weight.
With predictors, coefficients are chosen jointly to balance all the weighted contributions. An observation with a large weight can therefore change several coefficients, not just its own fitted value. Nor does a large weight guarantee that the model will fit that observation well: the predictor structure may not permit a close fit, or other heavily weighted observations may pull in a different direction.
Multiplying every weight by the same positive constant leaves many maximum-likelihood coefficient estimates unchanged, because it multiplies the entire log likelihood by that constant. However, it can change the apparent information and standard errors under a model that treats the weights as carrying information. In particular, do not rescale weights casually and then assume all inferential quantities retain the same interpretation. The coefficient fit and the uncertainty interpretation are separate questions.
Zero weights contribute nothing to the weighted likelihood, so their rows do not affect the fitted coefficients through that objective. Weights must not be negative for the ordinary interpretation above: a negative multiplier would subtract rather than weight a likelihood contribution and would not represent nonnegative information. In practice, inspect the weights for missing, negative, or unexpected zero values before fitting.
A Practical Interpretation Sequence
Before using prior weights in a GLM, work through the following questions. This keeps the statistical interpretation attached to the data rather than to the syntax alone.
Establish whether each row is an individual outcome, a proportion based on multiple trials, or another defined unit of observation.
Name the distribution, link, and any relevant variance or dispersion assumption before interpreting the weights.
Decide whether it encodes precision, a response-specific trial structure, or an explicitly defined likelihood emphasis. Do not assign a meaning merely because it is a common interpretation elsewhere.
An offset changes the linear predictor by a known amount; prior weights multiply likelihood contributions; working weights are calculated during fitting.
Review the weights, fitted values, and model assumptions, then explain what population or response process the weighted fit describes.
This sequence is aligned with the SOA Exam PA (Predictive Analytics) syllabus because interpreting a model requires more than reading the formula call. Candidates should be able to describe what is being weighted, why that weighting is defensible, and what the resulting fit does and does not represent.
Common Mistakes
- Calling every prior weight a frequency. A numeric weight may represent a likelihood multiplier, relative precision, or a response-specific count. Its meaning must come from the data representation and modeling assumptions.
- Using weights as a substitute for exposure. In a count-rate model, known exposure belongs in the rate specification, commonly through an offset. A prior weight is not automatically an exposure multiplier.
- Assuming weights have the same meaning across families. Gaussian precision weighting and a binomial proportion's trial-based weighting rest on different model interpretations.
- Confusing prior weights with working weights. The weights supplied to
glm()are part of the model fit; working weights are recalculated internally by the fitting algorithm. - Interpreting the fitted coefficients without checking the row definition. A weighted model describes a weighted likelihood for the records as represented. It does not automatically estimate the same target as an unweighted fit.
Check Your Understanding
For each problem, identify the model interpretation before calculating. All scenarios are hypothetical.
- An intercept-only Gaussian GLM has responses \(8,12,20\) and prior weights \(2,1,1\). Under independent \(N(\mu,\phi/w_i)\) observations with common unknown \(\phi\), calculate the fitted mean. (Answer: \(12\))
- An intercept-only binomial GLM uses binary outcomes \(1,0,1,0\) with row-level likelihood weights \(1,2,3,1\). Find the fitted probability and logit intercept, rounding the intercept to four decimals. (Answer: \(\widehat p=4/7\approx0.5714\); intercept \(\log(4/3)\approx0.2877\))
- An intercept-only Poisson GLM has counts \(1,3,0\) and likelihood-multiplier weights \(2,1,1\). Find the fitted mean and log-link intercept, rounding the intercept to four decimals. (Answer: \(\widehat\lambda=5/4=1.25\); intercept \(\log(1.25)\approx0.2231\))
- Under a Gaussian variance model \(\operatorname{Var}(Y_i)=\phi/w_i\), let \(\phi=9\). Compare the standard deviations for an observation with weight 1 and one with weight 4. (Answer: \(3\) and \(1.5\), respectively)
- An intercept-only Poisson fit has two counts, 0 and 4, each with weight 1. The analyst multiplies both weights by 3. What happens to the fitted mean, and how does the model-based standard error of the log-mean intercept change under the Poisson model? (Answer: the fitted mean remains \(2\); the standard error changes from \(1/2=0.5\) to \(1/\sqrt{12}\approx0.2887\))