From a Scenario to a GLM
A generalized linear model (GLM) is built by connecting three choices: the conditional distribution of the response, the link between its conditional mean and predictors, and the linear predictor. In a scenario, the response’s possible values and its variability provide important clues about those choices. They do not always determine a unique model, so the assumptions behind the choice must also be stated.
The central task is to model the distribution of \(Y_i\) given the predictors for observation \(i\), not merely to select a formula that fits a list of observed values. A response that is a count, a binary indicator, or a positive continuous measurement calls for different modeling considerations. This construction process is aligned with the SOA Exam SRM (Statistics for Risk Modeling) syllabus.
Here \(\mathbf{x}_i\) denotes the predictor values for observation \(i\), \(\beta_0,\ldots,\beta_p\) are coefficients, and \(\phi\) is a dispersion parameter when the chosen model has one. A standard GLM assumes that responses are conditionally independent given their predictors. Any particular scenario may require additional assumptions, such as equal observation periods for counts or a common dispersion parameter.
A useful construction order is to identify what values the response can take, determine the allowable range of its conditional mean, consider how its variance changes with that mean, and then choose a family, link, and predictor consistent with those features. A link must be valid on the mean range: applying its inverse to any real linear predictor should produce a permissible mean.
Decide whether each outcome is a count, an indicator, or a continuous measurement, and state its support.
The conditional mean must be compatible with the response. For example, a probability lies between zero and one, while a positive measurement has a positive mean.
Use the scenario’s assumptions about variability, not support alone, to assess a candidate random component.
Write \(g(\mu_i)=\eta_i\) and put the specified explanatory variables into \(\eta_i\). Check that the inverse link gives valid means.
Confirm that the distribution, mean, variance, and predictor tell a coherent story about the response.
Worked Scenarios
Worked Example: Counts Over Equal Observation Periods
A hypothetical insurer records the number \(Y_i\) of glass-repair claims for each insured vehicle over one full year. Each response is a nonnegative integer, and the modeling assumption is that, conditional on vehicle age score \(x_i\), the count is Poisson with mean \(\mu_i\). The scenario proposes that the expected count doubles when the age score increases by one. Construct a GLM and find the mean and variance at scores zero and one.
Method. A Poisson response has nonnegative integer support and conditional variance equal to its conditional mean. Its mean must be positive. The log link is a valid choice because its inverse, the exponential function, is positive for every real predictor.
The stated doubling pattern means \(\mu_i(1)=2\mu_i(0)\). With a log link, a one-unit increase in \(x_i\) changes the log mean by \(\log 2\). Suppose the baseline expected count is \(0.5\). Then the intercept is \(\log(0.5)\), giving
At \(x_i=0\), the linear predictor is \(\eta_i=\log(0.5)+(\log 2)(0)=\log(0.5)\). Therefore \(\mu_i=\exp(\eta_i)=0.5\), and the Poisson variance is \(0.5\).
At \(x_i=1\), \(\eta_i=\log(0.5)+\log 2=\log(1)=0\). Therefore \(\mu_i=\exp(0)=1\), and the variance is \(1\). The expected count has doubled from \(0.5\) to \(1\), as specified.
Check and common mistake avoided. Both fitted means are positive, and each variance equals its mean. A tempting but unsuitable choice would be the identity link with this same linear predictor: it is not guaranteed to produce positive means for all predictor values. The log link respects the mean constraint; it does not imply that an individual’s observed count must be an integer equal to the fitted mean.
Worked Example: A Binary Outcome With a Probability Mean
In a hypothetical study of a roadside assistance program, \(Y_i=1\) if a service request is resolved without a second dispatch and \(Y_i=0\) otherwise. Let \(x_i\) be the number of service steps completed in a preparation checklist. Assume that, conditional on \(x_i\), responses are independent Bernoulli observations with success probability \(p_i\). Construct a model with a linear predictor \(-2+x_i\), then calculate the probabilities and variances for \(x_i=1\) and \(x_i=2\).
Method. A Bernoulli response has support \(\{0,1\}\), so its conditional mean is a probability \(p_i\) between zero and one. Its variance is \(p_i(1-p_i)\). The logit link maps this open probability range to the real line and is appropriate for the stated unrestricted linear predictor:
For \(x_i=1\), \(\eta_i=-2+1=-1\). Inverting the logit gives \(p_i=1/(1+\exp(-\eta_i))=1/(1+\exp(1))\), which is approximately \(0.2689\). The variance is \(p_i(1-p_i)\), so it is approximately \(0.2689(0.7311)=0.1966\).
For \(x_i=2\), \(\eta_i=-2+2=0\). Thus \(p_i=1/(1+\exp(0))=0.5000\), and the variance is \(0.5000(1-0.5000)=0.2500\). The values are probabilities, so they are reported to four decimal places.
Check and common mistake avoided. Both probabilities lie between zero and one, and both variances are nonnegative. Using \(p_i=\eta_i\) would give \(-1\) at \(x_i=1\), which cannot be a probability. The linear predictor is on the link scale; it is not itself the conditional mean.
Worked Example: Positive Continuous Severity
A hypothetical maintenance program records the dollar cost \(Y_i\) of a completed repair. Assume the costs are positive and continuous. Conditional on equipment age category \(x_i\), assume a Gamma distribution with fixed shape \(k=4\). The expected cost is \(100\) dollars at \(x_i=0\) and doubles at \(x_i=1\). Construct a log-link model and calculate the means and variances.
Method. A Gamma response is appropriate under the stated positive continuous distributional assumption. With shape \(k\) and scale \(\theta_i\), its mean is \(k\theta_i=\mu_i\) and variance is \(k\theta_i^2=\mu_i^2/k\). Thus, at fixed shape \(4\), the variance is \(\mu_i^2/4\). The log link ensures a positive conditional mean.
The baseline mean \(100\) gives the intercept \(\log 100\). Doubling the mean for a one-unit increase in \(x_i\) gives the slope \(\log 2\). The model is
At \(x_i=0\), \(\mu_i=\exp(\log 100)=100\) dollars. The scale is \(\theta_i=100/4=25\), and the variance is \(4(25^2)=4(625)=2{,}500\) dollars squared. Equivalently, \(\mu_i^2/4=100^2/4=2{,}500\).
At \(x_i=1\), \(\mu_i=\exp(\log 100+\log 2)=200\) dollars. The scale is \(\theta_i=200/4=50\), and the variance is \(4(50^2)=4(2{,}500)=10{,}000\) dollars squared. Equivalently, \(200^2/4=10{,}000\). The cost mean doubles, while the variance quadruples under the fixed-shape assumption.
Check and common mistake avoided. Both means and scales are positive, as required. The variance is not assumed constant: because shape is fixed, it is proportional to the square of the mean. Treating these costs as Gaussian with constant variance would discard the distributional assumptions supplied in the scenario.
Why the Link Must Match the Mean
The link is not an arbitrary decoration on the predictor. It translates a predictor that can, in principle, take any real value into a conditional mean that must be allowed by the response model. For the log link, \(g(\mu)=\log\mu\), so the inverse is \(\mu=\exp(\eta)\). Since \(\exp(\eta)>0\) for every real \(\eta\), this link cannot yield a negative mean. It is therefore suitable for positive means, including Poisson and Gamma means.
For a binary response, the logit link is \(g(p)=\log(p/(1-p))\). Solving for \(p\) explains why its inverse stays within the probability range. Let \(e^\eta=p/(1-p)\). Multiplying by \(1-p\) gives \(e^\eta-e^\eta p=p\), so \(e^\eta=p(1+e^\eta)\), and hence \(p=e^\eta/(1+e^\eta)=1/(1+e^{-\eta})\). For every finite real \(\eta\), this value is strictly between zero and one.
The variance also provides a consistency check. For a Bernoulli variable, \(Y^2=Y\), so
This variance is largest at \(p=0.5\) and approaches zero as \(p\) approaches either boundary. In contrast, the Poisson variance equals its mean, while a Gamma model with fixed shape has variance proportional to the squared mean. These patterns can help assess a model, but they are assumptions to check against the scenario, not universal laws for all data with the same support.
Common Construction Traps
- Choosing from support alone. A positive continuous response may suit a Gamma model, but positivity alone does not establish a Gamma distribution. State the conditional distribution or justify it from the modeling assumptions.
- Putting the mean directly into the predictor. In general, \(g(\mu_i)=\eta_i\), not \(\mu_i=\eta_i\). An identity link is a valid choice only when it is suitable for the mean range and the scenario.
- Confusing an observation with its expectation. A Poisson observation is an integer, even when its fitted mean is, for example, \(0.5\). The model’s mean is not a predicted realized count.
- Ignoring the variance assumption. A Gamma distribution with fixed shape does not have constant variance. A proposed mean model can fit the support and still fail to reflect the stated variance behavior.
- Assuming the link is uniquely determined. Some links are canonical for common distributions, but a scenario may allow more than one valid link. Give the chosen link and check that its inverse yields permissible means.
Check Your Understanding
For each scenario, identify a suitable random component, link, and linear predictor or variance implication. Check that your choice is consistent with the stated response.
- A hypothetical depot records the number of equipment inspections completed in a fixed month. Assume a Poisson response and a mean of \(3\) when a workload score \(x\) is zero; the expected number triples when \(x\) increases by one. Give the model and the mean and variance at \(x=1\). (Answer: \(Y\mid x\sim\operatorname{Poisson}(\mu)\), \(\log\mu=\log 3+(\log 3)x\); at \(x=1\), \(\mu=9\) and \(\operatorname{Var}(Y\mid x)=9\).)
- A hypothetical inspection outcome is recorded as \(1\) for a defect and \(0\) otherwise. Its probability must remain between zero and one for any real predictor. Give a suitable response distribution, link, and inverse-link expression. (Answer: Bernoulli with mean \(p\), logit link \(\log(p/(1-p))=\eta\), and inverse \(p=1/(1+e^{-\eta})\).)
- A positive continuous repair cost is modeled as Gamma with fixed shape \(k=5\) and conditional mean \(\mu=150\). What is its conditional variance, and how would the variance change if the mean doubled while shape remained fixed? (Answer: \(\operatorname{Var}(Y\mid\mathbf{x})=\mu^2/5=4{,}500\); at mean \(300\), the variance is \(300^2/5=18{,}000\), four times as large.)
- A proposed model for a nonnegative count uses \(\eta=-0.4+0.2x\) and sets the conditional mean equal to \(\eta\). Explain the problem and give a suitable link-based correction for a Poisson response. (Answer: the identity choice can give negative means, for example \(\eta=-0.4\) at \(x=0\); use \(\log(\mu)=\eta\), so \(\mu=\exp(\eta)>0\).)
- A continuous response can take positive or negative values, and the scenario assumes normally distributed conditional errors with constant variance. Which conventional GLM random component and link fit those assumptions, and what is the mean range? (Answer: Gaussian random component with identity link, \(g(\mu)=\mu=\eta\); the conditional mean can be any real number.)