Image for Hat matrix

Hat matrix

The hat matrix is a mathematical tool used in statistics, specifically in linear regression, to help understand how well the model fits the data. It transforms the observed data points into predicted values, essentially "placing a hat" on each data point to estimate its value. Think of it as a way to measure how much influence each data point has on the model's predictions. The diagonal elements of this matrix indicate the influence or leverage of each data point; higher values mean the point has more impact on the model's outcome.