[R] cook's distance in weighted regression

John Fox jfox at mcmaster.ca
Sat Feb 12 03:34:46 CET 2005


Dear Alan,

You can use the (generic) cooks.distance function in R, which uses the
weighted residuals. See ?cooks.distance, and stats:::cooks.distance.lm for
the function definition (i.e., the method for a linear model).

Regards,
 John

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
-------------------------------- 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of 
> Dorfman, Alan - BLS
> Sent: Friday, February 11, 2005 11:08 AM
> To: 'r-help at stat.math.ethz.ch'
> Subject: [R] cook's distance in weighted regression
> 
> 
> I have a puzzle as to how R is computing Cook's distance in 
> weighted linear regression.
> 
> In
> this case cook's distance should be given not  as in OLS case by
> 
> h_ii*r_i^2/(1-hii)^2 divided by k*s^2                         
>            (1)
> (where  r is plain unadjusted residual, k is number of 
> parameters in model, etc. )
> 
> but rather by 
> 
> w_ii*h_ii*r_i^2/(1-hii)^2 divided by k*s^2,                   
>          (2)
> 
> i.e. has the weight in there. Apart from the division this is 
> sum of weighted squares of differences 
> 
> yhat_j - yhat_j[i]. (That is, it is the weighted sum of 
> squares of fits minus fits with ith point deleted.)
> 
> However, a little experimentation in R, using 
> ls.diag(fit)$cooks, suggests that in weighted case R gives 
> (1) times some constant. Does anybody know how that constant 
> is calculated?  What is the rationale for using equation (1) 
> (times a constant) in the weighted case anyway?  
> Thanks.
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list