Skip to content

Model Diagnostics Studio

The reference case: residuals scatter evenly around zero, no point has unusual leverage, and classical and HC3 standard errors agree. Select a point and move it to break any of these.

R² = 0.777, max Cook's D = 0.150

Data and OLS fit (bubble size = Cook's D)

02550751000714
Data and OLS fit (bubble size = Cook's D): ŷ = 22.59 + 3.75x, R² 0.777; largest Cook's D 0.150 at point 37.

Residuals vs fitted (line: running mean of 7)

fitted
Residuals vs fitted (line: running mean of 7): running mean from -7.4 through 1.2 to 0.4.

Leverage vs studentised residual (bubble = Cook's D)

leverage h
Leverage vs studentised residual (bubble = Cook's D): max h 0.102, cut-off 2k/n 0.100.

dashed: h = 2k/n and r = ±2; orange points have D > 4/n (conventions, not laws)

Coefficients

termbSE classicalt
(Intercept)22.5862.6558.51
x3.7490.32611.51

Breusch–Pagan (Koenker) LM 0.83, df 1, p 0.3624

Formula

h_ii = x_iᵀ(XᵀX)⁻¹x_i, r_i = e_i / (σ̂ √(1 − h_ii))D_i = r_i² h_ii / (k (1 − h_ii)), VIF_j = 1/(1 − R²_j)HC3: (XᵀX)⁻¹ Σ x_i x_iᵀ e_i²/(1 − h_ii)² (XᵀX)⁻¹

Diagnostics describe the fit; they do not certify causality or the choice of variables.

Method: Seeded synthetic data: 40 points with x spread over [1, 13.5] (over [1, 10] plus a planted point at x = 14 in the influential-point scenario), y = 20 + 4x + 7ε (well behaved), 10 + 14x − 0.9x² + 4ε (curved), 25 + 3.5x + 4ε (influential point), 12 + 3.5x + (0.3 + 1.4x)ε (heteroscedastic); x₂ = ρ(x − 7) + √(1 − ρ²)·3.5·z + 7. OLS by the normal equations (src/lib/engine/regression.ts): hat values, internally studentised residuals, Cook's D, HC3 (MacKinnon–White), VIF from auxiliary regressions, and Koenker's studentised Breusch–Pagan test. · Synthetic, seeded data. Illustrative, not an empirical finding.

Validation: Coefficients, classical and HC3 SEs, hat values, studentised residuals, Cook's D, VIF and the Breusch–Pagan LM and p match statsmodels (OLSInfluence, cov_type='HC3', variance_inflation_factor, het_breuschpagan) on eleven exported data sets to 1e-10 (tests/unit/model-diagnostics.test.ts); over 60 seeds Breusch–Pagan rejects in the heteroscedastic scenario at least 45 times and in the well-behaved one at most 8 times. · numerically validated