Description Usage Arguments Value Author(s) References See Also Examples
Calculates y-hat ≤ft( \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} ≤ft( \mathbf{X}^{T} \mathbf{X} \right)^{-1} \mathbf{X}^{T} .
1 | Py(X, y)
|
X |
|
y |
Numeric vector of length |
Returns y-hat ≤ft( \mathbf{\hat{y}} \right).
Ivan Jacob Agaloos Pesigan
Wikipedia: Ordinary Least Squares
Other y-hat functions:
.Py()
,
.Xbetahat()
,
Xbetahat()
,
yhat()
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Simple regression------------------------------------------------
X <- jeksterslabRdatarepo::wages.matrix[["X"]]
X <- X[, c(1, ncol(X))]
y <- jeksterslabRdatarepo::wages.matrix[["y"]]
Py <- Py(X = X, y = y)
hist(Py)
# Multiple regression----------------------------------------------
X <- jeksterslabRdatarepo::wages.matrix[["X"]]
# age is removed
X <- X[, -ncol(X)]
Py <- Py(X = X, y = y)
hist(Py)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.