Calculates y-hat \(\left( \mathbf{\hat{y}} \right)\), that is, the predicted value of \(\mathbf{y}\) given \(\mathbf{X}\) using $$ \mathbf{\hat{y}} = \mathbf{P} \mathbf{y} $$ where $$ \mathbf{P} = \mathbf{X} \left( \mathbf{X}^{T} \mathbf{X} \right)^{-1} \mathbf{X}^{T} . $$
.Py(y, P = NULL, X = NULL)
y | Numeric vector of length |
---|---|
P |
|
X |
|
Returns y-hat \(\left( \mathbf{\hat{y}} \right)\).
If P = NULL
, the P
matrix is computed using P()
with X
as its argument. If P
is provided, X
is not needed.
Wikipedia: Ordinary Least Squares
Ivan Jacob Agaloos Pesigan