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{X} \boldsymbol{\hat{β}}.
1 | yhat(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()
,
Py()
,
Xbetahat()
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"]]
yhat <- yhat(X = X, y = y)
hist(yhat)
# Multiple regression----------------------------------------------
X <- jeksterslabRdatarepo::wages.matrix[["X"]]
# age is removed
X <- X[, -ncol(X)]
yhat <- yhat(X = X, y = y)
hist(yhat)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.