Build regression projection matrices with precise matrix inputs. Inspect leverage, fitted values, and residual patterns. Understand influential observations through clear diagnostics and visual outputs.
| Observation | x1 | x2 | y |
|---|---|---|---|
| 1 | 1 | 2 | 5 |
| 2 | 2 | 1 | 6 |
| 3 | 3 | 4 | 11 |
| 4 | 4 | 3 | 12 |
| 5 | 5 | 5 | 16 |
This sample uses two predictors and an optional response vector. Turn on the intercept option to create a standard regression projection matrix.
Hat matrix formula: H = X(X′X)-1X′
Leverage values: hii are the diagonal elements of H.
Fitted response: ŷ = Hy
Residual vector: e = y - ŷ
Here, X is the design matrix. X′ is its transpose. The matrix X′X must be invertible. The hat matrix is symmetric and idempotent, meaning H = H′ and H2 = H.
It projects observed response values onto the column space of the design matrix. This projection creates fitted values in linear regression and reveals how strongly each observation influences its own fitted value.
Leverage values identify observations with unusual predictor patterns. High leverage points can pull the fitted model and deserve closer review, especially when they also have large residuals.
The trace equals the number of model columns in X, including any intercept. It is also the sum of all leverage values and helps verify that calculations are consistent.
Singularity usually means one predictor column is an exact linear combination of others. Remove duplicate or dependent columns, or revise the matrix so the model columns are independent.
No. The hat matrix depends only on the design matrix X. Vector y is optional and is used only when you want fitted responses, residuals, and PRESS-style residual diagnostics.
A true hat matrix satisfies H² = H. Small numerical differences appear because computers round decimals. A very small error suggests the projection matrix was computed correctly.
Both are common screening rules. The 2p/n rule is stricter, while 3p/n is more conservative. They are guides, not absolute proof of problematic observations.
Yes. Enable the intercept checkbox to prepend a column of ones to Matrix X. This is useful for standard linear regression models that include a constant term.
Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.