Skip to content

Commit f2a067a

Browse files
authored
add cooksdistance (#679)
Originate from the addition of the cooksdistance in GLM.jl for LinearModel. Discussed in JuliaStats/GLM.jl#415
1 parent bc20566 commit f2a067a

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StatsBase"
22
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
33
authors = ["JuliaStats"]
4-
version = "0.33.4"
4+
version = "0.33.5"
55

66
[deps]
77
DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"

docs/src/statmodels.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ crossmodelmatrix
3838
dof_residual
3939
fitted
4040
leverage
41+
cooksdistance
4142
meanresponse
4243
modelmatrix
4344
response

src/statmodels.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,15 @@ Return the diagonal of the projection matrix of the model.
353353
"""
354354
leverage(model::RegressionModel) = error("leverage is not defined for $(typeof(model)).")
355355

356+
"""
357+
cooksdistance(model::RegressionModel)
358+
359+
Compute [Cook's distance](https://en.wikipedia.org/wiki/Cook%27s_distance)
360+
for each observation in linear model `model`, giving an estimate of the influence
361+
of each data point.
362+
"""
363+
cooksdistance(model::RegressionModel) = error("cooksdistance is not defined for $(typeof(model)).")
364+
356365
"""
357366
residuals(model::RegressionModel)
358367

0 commit comments

Comments
 (0)