Skip to content

Commit

Permalink
Adjust definition of null model when there is no intercept (#14)
Browse files Browse the repository at this point in the history
Technically this is breaking, but the current definition gives negative R² for models without the intercept.
  • Loading branch information
nalimilan authored Jun 2, 2022
1 parent dfacfa6 commit d058f52
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "StatsAPI"
uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
authors = ["Milan Bouchet-Valat <[email protected]"]
version = "1.3.0"
version = "1.4.0"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
13 changes: 10 additions & 3 deletions src/statisticalmodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ function islinear end
"""
nulldeviance(model::StatisticalModel)
Return the deviance of the null model, that is the one including only the intercept.
Return the deviance of the null model, obtained by dropping all
independent variables present in `model`.
If `model` includes an intercept, the null model is the one with only the intercept;
otherwise, it is the one without any predictor (not even the intercept).
"""
function nulldeviance end

Expand All @@ -81,8 +85,11 @@ function loglikelihood end
"""
nullloglikelihood(model::StatisticalModel)
Return the log-likelihood of the null model corresponding to `model`.
This is usually the model containing only the intercept.
Return the log-likelihood of the null model, obtained by dropping all
independent variables present in `model`.
If `model` includes an intercept, the null model is the one with only the intercept;
otherwise, it is the one without any predictor (not even the intercept).
"""
function nullloglikelihood end

Expand Down

0 comments on commit d058f52

Please sign in to comment.