# Meaning of residual maker matrix

Suppose that $$M_1$$ is the residual maker for a unity vector (i.e. a vector made of $$n$$ 1's).

I am told that this matrix, when premultiplying a variable, transforms the variable "into deviations from its sample mean". What does this mean?

Let's consider the context of linear regression, where the least square estimator in matrix form is:

$$\hat{\mathbf{\beta}}= \begin{bmatrix} \hat{\beta_{0}} \\ \hat{\beta_{1}} \\ \vdots \\ \hat{\beta_{m}} \end{bmatrix} = (X'X)^{-1}X'\mathbf{y}$$

Let's call $$P=X(X'X)^{-1}X'$$ the prediction maker matrix.

For the residuals you simply do $$\mathbf{y}-\hat{\mathbf{y}}$$, which is equal to $$(I-P)\mathbf{y}$$. Hence, we call $$M=(I-P)$$ the residual maker matrix.

In your specific example, instead of a predictor matrix, you have a matrix that computes the mean of a variable, let's call it $$A$$. In this case, for a vector variable $$Z$$ you'd have $$(I-A)Z=Z-\overline{Z}$$, which is indeed $$Z$$ expressed as deviations from its mean value.