R/epsilonhat.R
My.Rd
Calculates residuals using $$ \boldsymbol{\hat{\varepsilon}} = \mathbf{My} . $$ where $$ \mathbf{M} = \mathbf{I} - \mathbf{P} \\ = \mathbf{I} - \mathbf{X} \left( \mathbf{X}^{T} \mathbf{X} \right)^{-1} \mathbf{X}^{T} . $$
My(X, y)
X |
|
---|---|
y | Numeric vector of length |
Returns an \(n \times 1\) matrix of residuals \(\left( \boldsymbol{\hat{\varepsilon}} \right)\), that is, the difference between the observed \(\left( \mathbf{y} \right)\) and predicted \(\left( \mathbf{\hat{y}} \right)\) values of the regressand variable \(\left( \boldsymbol{\hat{\varepsilon}} = \mathbf{y} - \mathbf{\hat{y}} \right)\).
Wikipedia: Errors and Residuals
Other residuals functions:
.My()
,
.tepsilonhat()
,
.yminusyhat()
,
epsilonhat()
,
tepsilonhat()
,
yminusyhat()
Ivan Jacob Agaloos Pesigan
# Simple regression------------------------------------------------ X <- jeksterslabRdatarepo::wages.matrix[["X"]] X <- X[, c(1, ncol(X))] y <- jeksterslabRdatarepo::wages.matrix[["y"]] My <- My(X = X, y = y) hist(My)# Multiple regression---------------------------------------------- X <- jeksterslabRdatarepo::wages.matrix[["X"]] # age is removed X <- X[, -ncol(X)] My <- My(X = X, y = y) hist(My)