Description Usage Arguments Details Value Author(s) References See Also Examples
Calculates the projection matrix ≤ft( \mathbf{P} \right) using
\mathbf{P} = \mathbf{X} ≤ft( \mathbf{X}^{T} \mathbf{X} \right)^{-1} \mathbf{X}^{T} .
1 | P(X)
|
X |
|
The projection matrix ≤ft( \mathbf{P} \right), also known as the hat matrix, transforms the \mathbf{y} vector to the vector of predicted values ≤ft( \mathbf{\hat{y}} = \mathbf{Py} \right).
Returns the projection matrix ≤ft( \mathbf{P} \right).
Ivan Jacob Agaloos Pesigan
Other projection matrix functions:
.M()
,
.h()
,
M()
,
h()
1 2 3 4 5 6 7 8 9 10 11 12 | # Simple regression------------------------------------------------
X <- jeksterslabRdatarepo::wages.matrix[["X"]]
X <- X[, c(1, ncol(X))]
P <- P(X = X)
str(P, list.len = 6)
# Multiple regression----------------------------------------------
X <- jeksterslabRdatarepo::wages.matrix[["X"]]
# age is removed
X <- X[, -ncol(X)]
P <- P(X = X)
str(P, list.len = 6)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.