← All Free Study Guides · Course: SRM

Module 2: Linear Models

Study manual for Exam SRM



1. Ordinary Least Squares (OLS) Formulation & Properties

The Multiple Linear Regression model relates a quantitative response YY to pp predictor variables X1,X2,…,XpX_1, X_2, \dots, X_p:

Y=β0+β1X1+β2X2+⋯+βpXp+εY = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \dots + \beta_p X_p + \varepsilon

In matrix notation for a sample of nn observations:

y=Xβ+ε\mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\varepsilon}

where:

X=(1x11x12…x1p1x21x22…x2p⋮⋮⋮⋱⋮1xn1xn2…xnp)\mathbf{X} = \begin{pmatrix} 1 & x_{11} & x_{12} & \dots & x_{1p} \\ 1 & x_{21} & x_{22} & \dots & x_{2p} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & x_{n1} & x_{n2} & \dots & x_{np} \end{pmatrix}

1.1 The Normal Equations & OLS Estimator

The OLS criterion chooses β^\hat{\boldsymbol{\beta}} to minimize the Residual Sum of Squares (RSS):

RSS(β)=∑i=1n(yi−y^i)2=(y−Xβ)T(y−Xβ)=yTy−2βTXTy+βTXTXβ\text{RSS}(\boldsymbol{\beta}) = \sum_{i=1}^n (y_i - \hat{y}_i)^2 = (\mathbf{y} - \mathbf{X}\boldsymbol{\beta})^T(\mathbf{y} - \mathbf{X}\boldsymbol{\beta}) = \mathbf{y}^T\mathbf{y} - 2\boldsymbol{\beta}^T\mathbf{X}^T\mathbf{y} + \boldsymbol{\beta}^T\mathbf{X}^T\mathbf{X}\boldsymbol{\beta}

Setting the gradient vector with respect to β\boldsymbol{\beta} equal to 0\mathbf{0}:

∂RSS∂β=−2XTy+2XTXβ=0  ⟹  XTXβ^=XTy\frac{\partial \text{RSS}}{\partial \boldsymbol{\beta}} = -2\mathbf{X}^T\mathbf{y} + 2\mathbf{X}^T\mathbf{X}\boldsymbol{\beta} = \mathbf{0} \implies \mathbf{X}^T\mathbf{X}\hat{\boldsymbol{\beta}} = \mathbf{X}^T\mathbf{y}

These are the Normal Equations. Assuming X\mathbf{X} has full column rank p+1≤np + 1 \le n (no perfect multicollinearity), the unique solution is:

β^=(XTX)−1XTy\hat{\boldsymbol{\beta}} = (\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{y}

1.2 Fitted Values and the Hat Matrix

The vector of fitted (predicted) values is:

y^=Xβ^=X(XTX)−1XTy=Hy\hat{\mathbf{y}} = \mathbf{X}\hat{\boldsymbol{\beta}} = \mathbf{X}(\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{y} = \mathbf{H}\mathbf{y}

where H=X(XTX)−1XT\mathbf{H} = \mathbf{X}(\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T is the n×nn \times n Hat Matrix (or projection matrix).

Mathematical Properties of the Hat Matrix H\mathbf{H}:

  1. Symmetric: HT=H\mathbf{H}^T = \mathbf{H}.
  2. Idempotent: H2=HH=H\mathbf{H}^2 = \mathbf{H}\mathbf{H} = \mathbf{H}.
  3. Trace: tr(H)=∑i=1nhii=p+1\text{tr}(\mathbf{H}) = \sum_{i=1}^n h_{ii} = p + 1 (the number of estimated parameters).
  4. Leverage Bounds: 1n≤hii≤1\frac{1}{n} \le h_{ii} \le 1. The average leverage across all observations is hˉ=p+1n\bar{h} = \frac{p + 1}{n}.
  5. Residuals: e=y−y^=(I−H)y\mathbf{e} = \mathbf{y} - \hat{\mathbf{y}} = (\mathbf{I} - \mathbf{H})\mathbf{y}. The matrix I−H\mathbf{I} - \mathbf{H} is also symmetric and idempotent with trace n−p−1n - p - 1.
  6. Residual Covariance: Var(e)=σ2(I−H)  ⟹  Var(ei)=σ2(1−hii)\text{Var}(\mathbf{e}) = \sigma^2 (\mathbf{I} - \mathbf{H}) \implies \text{Var}(e_i) = \sigma^2(1 - h_{ii}).

1.3 The Gauss-Markov Theorem


2. Reading and Reconstructing the Regression Output

Exam questions often present an incomplete R regression summary table and requires candidates to deduce missing entries.

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept)  15.4200     3.2500   4.745 2.84e-05 ***
driver_age   -0.4500     0.0900  -5.000 1.25e-05 ***
car_value     0.0820     0.0205   4.000 0.000281 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.50 on 47 degrees of freedom
Multiple R-squared:  0.6425,	Adjusted R-squared:  0.6273
F-statistic: 42.23 on 2 and 47 DF,  p-value: 1.15e-10

2.1 The ANOVA Partition of Total Sum of Squares

TSS=SSR+SSE\text{TSS} = \text{SSR} + \text{SSE}
∑i=1n(yi−yˉ)2=∑i=1n(y^i−yˉ)2+∑i=1n(yi−y^i)2\sum_{i=1}^n (y_i - \bar{y})^2 = \sum_{i=1}^n (\hat{y}_i - \bar{y})^2 + \sum_{i=1}^n (y_i - \hat{y}_i)^2
ComponentSum of SquaresDegrees of FreedomMean SquareExpected Mean Square
Regression (Model)SSR=∑(y^i−yˉ)2\text{SSR} = \sum (\hat{y}_i - \bar{y})^2ppMSR=SSRp\text{MSR} = \frac{\text{SSR}}{p}σ2+β1TXcTXcβ1p\sigma^2 + \frac{\boldsymbol{\beta}_1^T \mathbf{X}_c^T \mathbf{X}_c \boldsymbol{\beta}_1}{p}
Residual (Error)SSE=∑(yi−y^i)2\text{SSE} = \sum (y_i - \hat{y}_i)^2n−p−1n - p - 1MSE=σ^2=SSEn−p−1\text{MSE} = \hat{\sigma}^2 = \frac{\text{SSE}}{n - p - 1}σ2\sigma^2
Total (Corrected)TSS=∑(yi−yˉ)2\text{TSS} = \sum (y_i - \bar{y})^2n−1n - 1MST=TSSn−1\text{MST} = \frac{\text{TSS}}{n - 1}

2.2 Reconstructing Key Quantities from Output Statistics

  1. Residual Standard Error (ss or σ^\hat{\sigma}):
s=MSE=SSEn−p−1s = \sqrt{\text{MSE}} = \sqrt{\frac{\text{SSE}}{n - p - 1}}

Degrees of freedom for error: dfe=n−p−1df_e = n - p - 1. Sample size: n=dfe+p+1n = df_e + p + 1.

  1. Standard Error of a Slope Coefficient:
SE(β^j)=s[(XTX)−1]jj=sSxjxj(1−Rj2)\text{SE}(\hat{\beta}_j) = s \sqrt{\left[(\mathbf{X}^T\mathbf{X})^{-1}\right]_{jj}} = \frac{s}{\sqrt{S_{x_j x_j}(1 - R_j^2)}}

where Rj2R_j^2 is the R2R^2 from regressing XjX_j on all other p−1p-1 predictors.

  1. Individual tt-Statistic:
tj=β^j−0SE(β^j)∼tn−p−1t_j = \frac{\hat{\beta}_j - 0}{\text{SE}(\hat{\beta}_j)} \sim t_{n - p - 1}
  1. Coefficient of Determination (R2R^2):
R2=SSRTSS=1−SSETSSR^2 = \frac{\text{SSR}}{\text{TSS}} = 1 - \frac{\text{SSE}}{\text{TSS}}

R2R^2 measures the proportion of total variation in YY explained by the linear regression model.

  1. Adjusted R2R^2 (Radj2R_{\text{adj}}^2):
Radj2=1−SSE/(n−p−1)TSS/(n−1)=1−(1−R2)n−1n−p−1R_{\text{adj}}^2 = 1 - \frac{\text{SSE}/(n - p - 1)}{\text{TSS}/(n - 1)} = 1 - (1 - R^2)\frac{n - 1}{n - p - 1}
  1. Overall FF-Statistic: Tests the global null hypothesis H0:β1=β2=⋯=βp=0H_0: \beta_1 = \beta_2 = \dots = \beta_p = 0 against Ha:at least one βj≠0H_a: \text{at least one } \beta_j \neq 0:
F=MSRMSE=SSR/pSSE/(n−p−1)=R2/p(1−R2)/(n−p−1)∼Fp,  n−p−1F = \frac{\text{MSR}}{\text{MSE}} = \frac{\text{SSR}/p}{\text{SSE}/(n - p - 1)} = \frac{R^2 / p}{(1 - R^2)/(n - p - 1)} \sim F_{p, \; n - p - 1}

2.3 The Partial FF-Test for Nested Models

To test whether a subset of qq predictors can be simultaneously dropped from a full model with pp predictors (H0:βp−q+1=⋯=βp=0H_0: \beta_{p-q+1} = \dots = \beta_p = 0):

F=(SSEreduced−SSEfull)/qSSEfull/(n−p−1)=(SSEreduced−SSEfull)/qMSEfull∼Fq,  n−p−1F = \frac{(\text{SSE}_{\text{reduced}} - \text{SSE}_{\text{full}})/q}{\text{SSE}_{\text{full}}/(n - p - 1)} = \frac{(\text{SSE}_{\text{reduced}} - \text{SSE}_{\text{full}})/q}{\text{MSE}_{\text{full}}} \sim F_{q, \; n - p - 1}

In terms of R2R^2:

F=(Rfull2−Rreduced2)/q(1−Rfull2)/(n−p−1)F = \frac{(R_{\text{full}}^2 - R_{\text{reduced}}^2)/q}{(1 - R_{\text{full}}^2)/(n - p - 1)}

3. Confidence Intervals vs. Prediction Intervals

At a specified new predictor profile x0=(1,x01,…,x0p)T\mathbf{x}_0 = (1, x_{01}, \dots, x_{0p})^T, the point prediction is:

y^0=x0Tβ^\hat{y}_0 = \mathbf{x}_0^T\hat{\boldsymbol{\beta}}

Candidates must strictly distinguish between estimating the mean response versus predicting an individual observation.

Confidence interval for E[Y∣X=x0]E[Y \mid X = \mathbf{x}_0]Prediction interval for Y0=f(x0)+ε0Y_0 = f(\mathbf{x}_0) + \varepsilon_0
TargetPopulation mean μ0\mu_0A single unobserved future response Y0Y_0
Sources of uncertaintyParameter estimation error only, Var⁡(y^0)\Var(\hat{y}_0)Parameter estimation error plus the random noise ε0\varepsilon_0, with Var⁡(ε0)=σ2\Var(\varepsilon_0) = \sigma^2
Variances2 x0T(XTX)−1x0s^2\, \mathbf{x}_0^T (\mathbf{X}^T\mathbf{X})^{-1} \mathbf{x}_0s2(1+x0T(XTX)−1x0)s^2 \left(1 + \mathbf{x}_0^T (\mathbf{X}^T\mathbf{X})^{-1} \mathbf{x}_0\right)
WidthAlways narrower than the prediction intervalAlways wider than the confidence interval
As n→∞n \to \inftyShrinks to zeroDoes not shrink to zero (the noise σ\sigma remains)

3.1 Simple Linear Regression Formulas

For Simple Linear Regression with single predictor XX:

  1. Standard Error of the Mean Response:
SE(μ^0)=s1n+(x0−xˉ)2∑i=1n(xi−xˉ)2\text{SE}(\hat{\mu}_0) = s \sqrt{\frac{1}{n} + \frac{(x_0 - \bar{x})^2}{\sum_{i=1}^n (x_i - \bar{x})^2}}
100(1−α)% Confidence Interval:y^0±tn−2,  α/2⋅SE(μ^0)100(1 - \alpha)\% \text{ Confidence Interval}: \quad \hat{y}_0 \pm t_{n-2, \; \alpha/2} \cdot \text{SE}(\hat{\mu}_0)
  1. Standard Error of an Individual Prediction:
SE(y^pred)=s1+1n+(x0−xˉ)2∑i=1n(xi−xˉ)2\text{SE}(\hat{y}_{\text{pred}}) = s \sqrt{1 + \frac{1}{n} + \frac{(x_0 - \bar{x})^2}{\sum_{i=1}^n (x_i - \bar{x})^2}}
100(1−α)% Prediction Interval:y^0±tn−2,  α/2⋅SE(y^pred)100(1 - \alpha)\% \text{ Prediction Interval}: \quad \hat{y}_0 \pm t_{n-2, \; \alpha/2} \cdot \text{SE}(\hat{y}_{\text{pred}})

4. Special Predictors: Categorical Variables & Interactions

4.1 Categorical Predictors (Dummy Variables)

When a qualitative predictor has cc distinct categories (e.g., Territory = {Urban, Suburban, Rural}, c=3c=3):

Example with reference level = Rural:

DUrban={1if Urban0otherwise,DSuburban={1if Suburban0otherwiseD_{\text{Urban}} = \begin{cases} 1 & \text{if Urban} \\ 0 & \text{otherwise} \end{cases}, \qquad D_{\text{Suburban}} = \begin{cases} 1 & \text{if Suburban} \\ 0 & \text{otherwise} \end{cases}

Model:

Y=β0+β1DUrban+β2DSuburban+β3Xage+εY = \beta_0 + \beta_1 D_{\text{Urban}} + \beta_2 D_{\text{Suburban}} + \beta_3 X_{\text{age}} + \varepsilon

4.2 Interaction Terms

An interaction term allows the effect of one predictor on YY to depend on the level of another predictor.

Y=β0+β1X1+β2X2+β3(X1X2)+εY = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \beta_3 (X_1 X_2) + \varepsilon

Rearranging:

Y=β0+(β1+β3X2)X1+β2X2+εY = \beta_0 + (\beta_1 + \beta_3 X_2) X_1 + \beta_2 X_2 + \varepsilon

5. Regression Diagnostics, Leverage & Influence

OLS residuals are defined as ei=yi−y^ie_i = y_i - \hat{y}_i.

5.1 The Four Classic R Diagnostic Plots

When calling plot(model) in R, four diagnostic graphs are rendered to test OLS assumptions:

R Diagnostic Plot 1: Residuals vs Fitted Values
-1001020406080e = 0Fitted values (ŷ)Residuals (eᵢ)
  • Zero Reference Line
  • Observed Residuals
  • LOWESS Smoother

Checks Linearity & Homoskedasticity. A well-specified model exhibits an evenly distributed, random scatter of residuals around zero with a roughly horizontal red LOWESS trendline.

R Diagnostic Plot 2: Normal Q-Q Plot of Standardized Residuals
-202-3-2-10123Theoretical Standard Normal QuantilesStandardized Residuals
  • 45-Degree Reference Line
  • Sample Residual Quantiles

Checks Normality of Errors. Residual quantiles closely tracking the diagonal 45-degree dashed line confirm the assumption of normally distributed error terms.

Diagnostic GraphTarget AssessmentDesired Benchmark PatternActuarial Warning FlagCorrective Actuarial Action
1. Residuals vs. FittedLinearity & HomoskedasticityRandom horizontal band centered at 0Parabolic U-shape (non-linearity) or funnel widening (heteroskedasticity)Add polynomial terms (X2X^2), log-transform YY, or fit GLM (Gamma/Poisson)
2. Normal Q-Q PlotError Normality (εi∼N\varepsilon_i \sim \mathcal{N})Points lie on 45° reference lineS-shape / heavy tails (kurtosis) or upward bow (skewness)Log-transform right-skewed claims or adopt heavy-tailed distribution
3. Scale-LocationConstant Spread (Homoskedasticity)Horizontal smoother with random scatterPositive slope / widening spreadApply Weighted Least Squares (WLS) or log transform
4. Residuals vs. LeverageInfluential Cases (Cook's DD)All points inside D<0.5D < 0.5 boundariesPoints beyond D=0.5D = 0.5 or D=1.0D = 1.0 contourInvestigate data errors, re-evaluate leverage hiih_{ii}

5.2 Leverage, Outliers, and Cook's Distance

Actuaries must strictly distinguish between an outlier, a high-leverage point, and an influential point:

CategoryDefinition & Metric ThresholdPrimary Geometric DriverImpact on OLS RegressionCorrective Action
OutlierLarge studentized residual: ∥ri∥>2\|r_i\| > 2 or 33Extreme in the YY-direction (unusual claim severity)Inflates s2=MSEs^2 = \text{MSE}, widens confidence intervals, dampens R2R^2Audit claim file for recording errors; evaluate robust regression
High Leverage PointHigh diagonal leverage: hii>2(p+1)nh_{ii} > \frac{2(p+1)}{n}Extreme in the XX-direction (far from feature centroid xˉ\bar{\mathbf{x}})High potential influence, but may not shift slope if on regression lineCheck predictor accuracy; collect more data in sparse regions
Influential ObservationCook's distance Di>0.5D_i > 0.5 (caution) or Di>1.0D_i > 1.0 (severe)Extreme in BOTH XX-space and YY-spaceSubstantially alters estimated slopes β^\hat{\beta} when included vs excludedReport model sensitivity with and without observation; evaluate truncation
  1. Standardized Residuals:
ei∗=eis1−hiie_i^* = \frac{e_i}{s \sqrt{1 - h_{ii}}}
  1. Studentized (Internally/Externally Studentized) Residuals (rir_i):
ri=eis(−i)1−hiir_i = \frac{e_i}{s_{(-i)} \sqrt{1 - h_{ii}}}

where s(−i)s_{(-i)} is the estimated standard error computed with observation ii omitted. Values ∣ri∣>3|r_i| > 3 indicate severe outliers.

  1. Leverage (hiih_{ii}): Measures how far observation ii's predictors are from the sample mean of all predictors.
hˉ=p+1n\bar{h} = \frac{p+1}{n}
Di=∑j=1n(y^j−y^j(−i))2(p+1)s2=ei2(p+1)s2(hii(1−hii)2)D_i = \frac{\sum_{j=1}^n (\hat{y}_j - \hat{y}_{j(-i)})^2}{(p + 1) s^2} = \frac{e_i^2}{(p + 1) s^2} \left(\frac{h_{ii}}{(1 - h_{ii})^2}\right)

5.3 Multicollinearity and the Variance Inflation Factor (VIF)

Collinearity occurs when two or more predictor variables are closely correlated with each other.

Consequences of Collinearity:

The Variance Inflation Factor (VIF):

For each predictor XjX_j:

VIFj=11−Rj2\text{VIF}_j = \frac{1}{1 - R_j^2}

where Rj2R_j^2 is the R2R^2 obtained from regressing predictor XjX_j onto all remaining p−1p - 1 predictors.


6. Model Selection Criteria & Subset Selection

Adding predictors to an OLS model always reduces training RSS and increases R2R^2. To prevent overfitting, penalized criteria adjust for model complexity d=p+1d = p + 1 (the total number of parameters including the intercept).

6.1 Mallows' CpC_p, AIC, and BIC

Let dd denote the number of parameters in the candidate model (including intercept), let RSS\text{RSS} be its residual sum of squares, and let σ^2\hat{\sigma}^2 be an unbiased estimate of σ2\sigma^2 obtained from the full model with all available predictors.

  1. Mallows' CpC_p:
Cp=1n(RSS+2dσ^2)C_p = \frac{1}{n}\left(\text{RSS} + 2d\hat{\sigma}^2\right)

An unbiased model has E[Cp]≈dE[C_p] \approx d. We seek models with small CpC_p values close to or below dd.

  1. Akaike Information Criterion (AIC): Under normality and known σ^2\hat{\sigma}^2, AIC is proportional to Mallows' CpC_p:
AIC=1nσ^2(RSS+2dσ^2)\text{AIC} = \frac{1}{n\hat{\sigma}^2}\left(\text{RSS} + 2d\hat{\sigma}^2\right)
  1. Bayesian Information Criterion (BIC):
BIC=1nσ^2(RSS+ln⁡(n)dσ^2)\text{BIC} = \frac{1}{n\hat{\sigma}^2}\left(\text{RSS} + \ln(n)d\hat{\sigma}^2\right)

6.2 Subset Selection Algorithms

Selection MethodSearch ScopeComputational CostApplicability when p≥np \ge n
Best Subset SelectionFits all 2p2^p possible submodels. Identifies the model with minimal RSS for each size k∈{0,1,…,p}k \in \{0, 1, \dots, p\}.O(2p)\mathcal{O}(2^p): Intractable for p>30p > 30.Cannot be used when p≥np \ge n (requires p<np < n).
Forward StepwiseStarts with null model (intercept only). Sequentially adds the single predictor that yields greatest RSS reduction, until all pp predictors are added.O(p2)\mathcal{O}(p^2): Fits 1+p(p+1)21 + \frac{p(p+1)}{2} models.Can be applied even when p≥np \ge n (can add up to n−1n-1 predictors).
Backward StepwiseStarts with full model containing all pp predictors. Sequentially removes the least useful predictor (smallest tt / largest pp-value).O(p2)\mathcal{O}(p^2): Fits 1+p(p+1)21 + \frac{p(p+1)}{2} models.Cannot be used when p≥np \ge n (full model cannot be fitted).

7. Regularization & Shrinkage Methods

When pp is large relative to nn, OLS has high variance. When p>np > n, OLS is completely ill-defined (infinite solutions with 0 training error). Regularization constrains or shrinks the coefficient estimates toward zero.

Ridge regression (L2L_2)Lasso regression (L1L_1)
Penaltyλ∑βj2\lambda \sum \beta_j^2λ∑∣βj∣\lambda \sum \lvert\beta_j\rvert
Constraint regionCircularDiamond, with corners
Effect on coefficientsShrinks them toward 00Drives some exactly to 00
Predictors keptAll pp predictorsPerforms variable selection
Works best whenMany predictors have small, spread-out effectsA sparse subset of predictors truly affects the response
SolutionClosed formNo closed form; solved numerically

7.1 Ridge Regression (L2L_2 Penalty)

Ridge regression minimizes a penalized sum of squares:

Objective=∑i=1n(yi−β0−∑j=1pβjxij)2+λ∑j=1pβj2=RSS+λ∥β∥22\text{Objective} = \sum_{i=1}^n \left(y_i - \beta_0 - \sum_{j=1}^p \beta_j x_{ij}\right)^2 + \lambda \sum_{j=1}^p \beta_j^2 = \text{RSS} + \lambda \|\boldsymbol{\beta}\|_2^2

where λ≥0\lambda \ge 0 is a tuning parameter (hyperparameter).

β^ridge=(XTX+λI)−1XTy\hat{\boldsymbol{\beta}}_{\text{ridge}} = (\mathbf{X}^T\mathbf{X} + \lambda \mathbf{I})^{-1}\mathbf{X}^T\mathbf{y}

Even when XTX\mathbf{X}^T\mathbf{X} is singular (p>np > n or perfect multicollinearity), XTX+λI\mathbf{X}^T\mathbf{X} + \lambda \mathbf{I} is always strictly positive definite and invertible for any λ>0\lambda > 0!

7.2 Lasso Regression (L1L_1 Penalty and Variable Selection)

Lasso (Least Absolute Shrinkage and Selection Operator) minimizes:

Objective=∑i=1n(yi−β0−∑j=1pβjxij)2+λ∑j=1p∣βj∣=RSS+λ∥β∥1\text{Objective} = \sum_{i=1}^n \left(y_i - \beta_0 - \sum_{j=1}^p \beta_j x_{ij}\right)^2 + \lambda \sum_{j=1}^p |\beta_j| = \text{RSS} + \lambda \|\boldsymbol{\beta}\|_1

7.3 Tuning Parameter Selection via Cross-Validation

The optimal tuning parameter λ\lambda is chosen using kk-fold cross-validation (typically 10-fold):


8. R code and output interpretation lab

8.1 Multiple Regression Summary Table

r
fit <- lm(claim_cost ~ age + vehicle_type + annual_miles, data = auto_data)
summary(fit)
Call:
lm(formula = claim_cost ~ age + vehicle_type + annual_miles, data = auto_data)

Residuals:
    Min      1Q  Median      3Q     Max
-1240.2  -310.5   -12.4   289.1  2410.8

Coefficients:
                    Estimate Std. Error t value Pr(>|t|)
(Intercept)         420.5000   112.4000   3.741 0.000241 ***
age                  -8.2500     2.1500  -3.837 0.000167 ***
vehicle_typeSedan   120.4000    45.2000   2.664 0.008341 **
vehicle_typeSUV     285.6000    52.1000   5.482 1.34e-07 ***
annual_miles          0.0450     0.0090   5.000 1.25e-06 ***
---
Residual standard error: 485.2 on 245 degrees of freedom
Multiple R-squared:  0.3842,	Adjusted R-squared:  0.3741
F-statistic: 38.21 on 4 and 245 DF,  p-value: < 2.2e-16

Line-by-Line Interpretation:

  1. Reference Level: The baseline vehicle type omitted from the table is the reference category (e.g., Truck).
    • An otherwise identical Sedan incurs on average $120.40\$120.40 more in claim costs than a Truck (t=2.664,p=0.0083t = 2.664, p = 0.0083).
    • An SUV incurs on average $285.60\$285.60 more than a Truck (t=5.482,p<0.001t = 5.482, p < 0.001).
  2. Degrees of Freedom & Sample Size:
    • Error degrees of freedom =245= 245.
    • Parameters estimated: 1 intercept + 4 slopes =5= 5.
    • Total sample size n=245+5=250n = 245 + 5 = 250.
  3. Overall Model Utility:
    • F=38.21F = 38.21 with p<2.2×10−16p < 2.2 \times 10^{-16}. Strongly rejects H0:β1=β2=β3=β4=0H_0: \beta_1 = \beta_2 = \beta_3 = \beta_4 = 0.

8.2 Regularized Regression with glmnet

r
library(glmnet)

# Matrix preparation (glmnet requires model matrix X and vector y)
X <- model.matrix(claim_cost ~ age + vehicle_type + annual_miles, data = auto_data)[, -1]
y <- auto_data$claim_cost

# 1. Fit Ridge Regression (alpha = 0)
ridge_fit <- glmnet(X, y, alpha = 0)

# 2. Fit Lasso Regression (alpha = 1)
lasso_fit <- glmnet(X, y, alpha = 1)

# 3. 10-fold Cross-Validation for Lasso
set.seed(2027)
cv_lasso <- cv.glmnet(X, y, alpha = 1)

best_lam <- cv_lasso$lambda.min  # Lambda minimizing MSE
se1_lam  <- cv_lasso$lambda.1se  # Most parsimonious model within 1 SE

# Extract coefficients at lambda.1se
coef(cv_lasso, s = "lambda.1se")
# Notice: Unimportant predictors are driven to EXACTLY zero (.)

9. Common traps


10. Master Practice Question Vault

Question 1: Partial FF-Test for Nested Policyholder Predictors

An actuarial analyst models comprehensive automobile insurance claim severity.

Calculate the partial FF-statistic testing whether the 2 dropped predictors can be excluded, and state the numerator and denominator degrees of freedom.

  1. AF=8.00F = 8.00; df=(2,80)df = (2, 80)
  2. BF=6.00F = 6.00; df=(2,80)df = (2, 80)
  3. CF=6.00F = 6.00; df=(2,81)df = (2, 81)
  4. DF=4.00F = 4.00; df=(2,80)df = (2, 80)
  5. EF=12.00F = 12.00; df=(2,84)df = (2, 84)

Detailed 4-Step Solution:

  1. Actuarial Formula:
F=(SSEreduced−SSEfull)/qSSEfull/(n−p−1)F = \frac{(\text{SSE}_{\text{reduced}} - \text{SSE}_{\text{full}})/q}{\text{SSE}_{\text{full}}/(n - p - 1)}
  1. Degrees of Freedom:
    • Numerator df1=q=2df_1 = q = 2.
    • Denominator df2=n−p−1=87−6−1=80df_2 = n - p - 1 = 87 - 6 - 1 = 80.
  2. Calculate Sum of Squares:
    • Numerator difference: SSEreduced−SSEfull=4,600−4,000=600\text{SSE}_{\text{reduced}} - \text{SSE}_{\text{full}} = 4,600 - 4,000 = 600.
    • Mean square for dropped terms: 6002=300\frac{600}{2} = 300.
    • Full model error variance: MSEfull=4,00080=50\text{MSE}_{\text{full}} = \frac{4,000}{80} = 50.
  3. Evaluate FF-Statistic:
F=30050=6.00F = \frac{300}{50} = 6.00

On 2 and 80 degrees of freedom. Correct Option: (B)


Question 2: A BIC calculation

A linear regression model with p=4p = 4 predictors (d=5d = 5 parameters including the intercept) is fitted to n=150n = 150 observations. The model achieves a Residual Sum of Squares RSS=1,200\text{RSS} = 1,200. An estimate of the error variance from the full model is σ^2=10.0\hat{\sigma}^2 = 10.0.

Calculate the Bayesian Information Criterion (BIC) using the definition given in this module.

  1. A1.48
  2. B1.25
  3. C1.63
  4. D0.967
  5. E12.45

Detailed 4-Step Solution:

  1. Governing formula:
BIC=1nσ^2(RSS+ln⁡(n)dσ^2)\text{BIC} = \frac{1}{n\hat{\sigma}^2}\left(\text{RSS} + \ln(n) d \hat{\sigma}^2\right)
  1. Substitute Known Parameters:
    • n=150  ⟹  ln⁡(150)≈5.010635n = 150 \implies \ln(150) \approx 5.010635.
    • d=p+1=5d = p + 1 = 5.
    • σ^2=10.0\hat{\sigma}^2 = 10.0.
    • RSS=1,200\text{RSS} = 1,200.
  2. Calculate Penalty Term:
ln⁡(n)dσ^2=5.010635×5×10.0=250.5318\ln(n) d \hat{\sigma}^2 = 5.010635 \times 5 \times 10.0 = 250.5318
  1. Evaluate BIC:
Numerator=1,200+250.5318=1,450.5318\text{Numerator} = 1,200 + 250.5318 = 1,450.5318
Denominator=nσ^2=150×10.0=1,500\text{Denominator} = n\hat{\sigma}^2 = 150 \times 10.0 = 1,500
BIC=1,450.53181,500=0.967\text{BIC} = \frac{1,450.5318}{1,500} = 0.967

Splitting the two terms shows where the penalty comes from: By that definition: BIC=1nσ^2(RSS+ln⁡(n)dσ^2)=RSSnσ^2+ln⁡(n)dn=12001500+5.01×5150=0.80+0.167=0.967\text{BIC} = \frac{1}{n\hat{\sigma}^2}(\text{RSS} + \ln(n)d\hat{\sigma}^2) = \frac{\text{RSS}}{n\hat{\sigma}^2} + \frac{\ln(n)d}{n} = \frac{1200}{1500} + \frac{5.01 \times 5}{150} = 0.80 + 0.167 = 0.967. Correct Option: (D)


Question 3: Cook's Distance Computation

In an OLS regression with p=3p = 3 predictors (k=p+1=4k = p + 1 = 4 parameters) and n=40n = 40 observations, the residual mean square is s2=25.0s^2 = 25.0. Observation 12 has an OLS residual of e12=10.0e_{12} = 10.0 and a leverage value of h12=0.20h_{12} = 0.20.

Calculate Cook's distance D12D_{12} for this observation.

  1. A0.250
  2. B0.125
  3. C0.313
  4. D0.391
  5. E0.500

Detailed 4-Step Solution:

  1. Governing Formula:
Di=ei2(p+1)s2(hii(1−hii)2)D_i = \frac{e_i^2}{(p + 1) s^2} \left(\frac{h_{ii}}{(1 - h_{ii})^2}\right)
  1. Substitute Known Values:
    • e12=10.0  ⟹  e122=100.0e_{12} = 10.0 \implies e_{12}^2 = 100.0.
    • k=p+1=4k = p + 1 = 4.
    • s2=25.0  ⟹  ks2=4×25.0=100.0s^2 = 25.0 \implies k s^2 = 4 \times 25.0 = 100.0.
    • h12=0.20  ⟹  1−h12=0.80  ⟹  (1−h12)2=0.64h_{12} = 0.20 \implies 1 - h_{12} = 0.80 \implies (1 - h_{12})^2 = 0.64.
  2. Compute Components:
    • Residual ratio: e122ks2=100.0100.0=1.00\frac{e_{12}^2}{k s^2} = \frac{100.0}{100.0} = 1.00.
    • Leverage multiplier: h12(1−h12)2=0.200.64=0.3125\frac{h_{12}}{(1 - h_{12})^2} = \frac{0.20}{0.64} = 0.3125.
  3. Evaluate D12D_{12}:
D12=1.00×0.3125=0.3125≈0.313D_{12} = 1.00 \times 0.3125 = 0.3125 \approx 0.313

Correct Option: (C)

Related Exam SRM Free Study Guides & Syllabus

Continue studying the Exam SRM syllabus, formula sheets, and practice bank with these free companion modules:

Ready to test this topic under exam pressure?

Practice worked questions with step-by-step solutions and distractor trap diagnostics.

Open Interactive Version →