You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been looking for this functionality and couldn't find it. So I created the function for doing so. (Derived from here: https://en.wikipedia.org/wiki/Leverage_(statistics)) I tested it against R's hatvalues and it gives similar results.
function leverage(model::RegressionModel)
X = model.mm.m;
H = diag(X * ( ( X' * X ) ^ -1) * X');
return H;
end
I think @ararslan had an implementation somewhere -- oh yeah as part of his work on Cook's Distance for GLM: #510
@HiramTheHero your proposal is mathematically correct but generally computing an explicit matrix inverse is less than ideal. The inverse is slow to compute and the result is often very sensitive to numerical details.
(Almost nothing in statistics except the sample mean is computed in practice with the textbook formulas. 🙁 )
Now that we have Cook's Distance, we can define this rather straightforwardly.
The text was updated successfully, but these errors were encountered: