Description Usage Arguments Value Author(s) References See Also Examples
Calculates leverage, that is, how far away the regressor values of an observation are from those of the other observations using
h_{ii} = x_{i}^{T} ≤ft( \mathbf{X}^{T} \mathbf{X} \right)^{-1} x_{i}
where x_{i}^{T} is the ith row of the \mathbf{X} matrix. Note that \mathbf{X} ≤ft( \mathbf{X}^{T} \mathbf{X} \right)^{-1} \mathbf{X}^{T} is the projection matrix (or hat matrix) \mathbf{P} and h_{ii} is the diagonal of \mathbf{P}.
1 | h(X)
|
X |
|
Returns leverage.
Ivan Jacob Agaloos Pesigan
Other projection matrix functions:
.M()
,
.h()
,
M()
,
P()
1 2 3 4 5 6 7 8 9 10 11 12 | # Simple regression------------------------------------------------
X <- jeksterslabRdatarepo::wages.matrix[["X"]]
X <- X[, c(1, ncol(X))]
h <- h(X = X)
hist(h)
# Multiple regression----------------------------------------------
X <- jeksterslabRdatarepo::wages.matrix[["X"]]
# age is removed
X <- X[, -ncol(X)]
h <- h(X = X)
hist(h)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.