Skip to content

Commit d058f52

Browse files
authored
Adjust definition of null model when there is no intercept (#14)
Technically this is breaking, but the current definition gives negative R² for models without the intercept.
1 parent dfacfa6 commit d058f52

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StatsAPI"
22
uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
33
authors = ["Milan Bouchet-Valat <[email protected]"]
4-
version = "1.3.0"
4+
version = "1.4.0"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/statisticalmodel.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ function islinear end
5757
"""
5858
nulldeviance(model::StatisticalModel)
5959
60-
Return the deviance of the null model, that is the one including only the intercept.
60+
Return the deviance of the null model, obtained by dropping all
61+
independent variables present in `model`.
62+
63+
If `model` includes an intercept, the null model is the one with only the intercept;
64+
otherwise, it is the one without any predictor (not even the intercept).
6165
"""
6266
function nulldeviance end
6367

@@ -81,8 +85,11 @@ function loglikelihood end
8185
"""
8286
nullloglikelihood(model::StatisticalModel)
8387
84-
Return the log-likelihood of the null model corresponding to `model`.
85-
This is usually the model containing only the intercept.
88+
Return the log-likelihood of the null model, obtained by dropping all
89+
independent variables present in `model`.
90+
91+
If `model` includes an intercept, the null model is the one with only the intercept;
92+
otherwise, it is the one without any predictor (not even the intercept).
8693
"""
8794
function nullloglikelihood end
8895

0 commit comments

Comments
 (0)