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