R/epsilonhat.R
dot-yminusyhat.Rd
Calculates residuals using $$ \hat{\varepsilon}_{i} = Y_{i} - \hat{Y}_{i} \\ = Y_{i} - \left( \hat{\beta}_{1} + \hat{\beta}_{2} X_{2i} + \hat{\beta}_{3} X_{3i} + \dots + \hat{\beta}_{k} X_{ki} \right) \\ = Y_{i} - \hat{\beta}_{1} - \hat{\beta}_{2} X_{2i} - \hat{\beta}_{3} X_{3i} - \dots - \hat{\beta}_{k} X_{ki} . $$ In matrix form $$ \boldsymbol{\hat{\varepsilon}} = \mathbf{y} - \mathbf{\hat{y}} \\ = \mathbf{y} - \mathbf{X} \boldsymbol{\hat{\beta}} . $$
.yminusyhat(y, yhat = NULL, X = NULL, betahat = NULL)
y | Numeric vector of length |
---|---|
yhat | Numeric vector of length |
X |
|
betahat | 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)\).
If yhat = NULL
, the yhat
vector is computed using Xbetahat()
with X
as a required argument and betahat
as an optional argument.
If yhat
is provided, X
and betahat
are not needed.
Wikipedia: Errors and Residuals
Other residuals functions:
.My()
,
.tepsilonhat()
,
My()
,
epsilonhat()
,
tepsilonhat()
,
yminusyhat()
Ivan Jacob Agaloos Pesigan