File Exchange

image thumbnail

Leverage & Cook's distance

version (1.6 KB) by Joris Meurs
Function for calculating leverage and Cook's distance without the use of toolboxes

1 Download

Updated 21 Jul 2016

View License

File name: 'levcook.m'. Function for calculating Cook's distance
and leverage without using the Statistic Toolbox.
Formula for leverage:
h = 1/L + (x-mean(x)).^2./sum((x-mean(x)).^2)
Formula for Cook's distance:
D = (err./(RMSE*p)).*(h./((1-h).^2))
Three input parameters: 'x', 'y' and 'p'
Two output parameters: 'h' and 'D'

x: Vector of x-variables
y: Vector of y-variables
p: Number of regression parameters (Default = 2)
h: Leverage
D: Cook's distance

Additionally, plots for leverage and Cook's distance will be

Developed by Joris Meurs BASc (2016)

Comments and Ratings (3)

Exactly what I needed! Thanks!

Joris Meurs

.m file is added

Hank Li

No Code in the Zip File.


- .m file added

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux