I calculated Cook's distance manually and with the function cooks.distance with Beta Regression and I got two different results. Can someone please help me understand why?
Below is how I calculate Cook's distance (s):
require(betareg)
df<-data("ReadingSkills")
y<-ReadingSkills$accuracy
n<-length(y)
bfit<-betareg(accuracy ~ dyslexia + iq, data = ReadingSkills)
yhat<-fitted(bfit)
cook<-cooks.distance(bfit)
hatv<-hatvalues(bfit)
res<-residuals(bfit, type = "response")
RHS<-hatv/(1-hatv)
s23<-var(res)###
p23<-res^2/s23
Response<-(1/2)*p23*RHS
cbind(Response, cook)
As recamended here How to manually calculate Cook's distance I tried 3 inspite of 2 but same problem.
Thank you in advance for your help!