Calculating and Interpreting Hat Values
You'll learn: How to compute leverage statistics (hat values) and use simple thresholds to flag observations that have unusual influence potential based on their predictor values.
What Are Hat Values?
In the previous lesson, you learned that leverage measures how far an observation's predictor value (X) is from the average. The mathematical way we quantify leverage is through hat values, denoted as h_ii (or just h_i).
The name comes from the "hat matrix" in linear algebra that "puts the hat" on Y to get Ŷ (fitted values). Each diagonal element h_ii tells you how much leverage observation i has.
The Formula and Intuition
For simple linear regression with one predictor:
h_ii = 1/n + (x_i - x̄)² / Σ(x_j - x̄)²
Where:
n= number of observationsx_i= predictor value for observation ix̄= mean of all predictor values
What this means: Hat values range from 1/n to 1. The farther x_i is from the mean, the higher the hat value.
Identifying High-Leverage Points
A common threshold for flagging high-leverage observations is:
h_ii > 2p/n
Where:
p= number of parameters (in simple regression, p = 2: intercept + slope)n= sample size
For simple regression: flag points with h_ii > 4/n
Example: With n=100, flag observations where h_ii > 0.04
Key Takeaway: Hat values quantify leverage numerically; use the 2p/n threshold to identify observations with unusually high leverage that deserve closer inspection for their potential influence on your regression results.