-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add hasintercept #17
base: main
Are you sure you want to change the base?
add hasintercept #17
Conversation
This is useful to compute the correct degrees of freedoms to be used in t-test
Codecov ReportPatch coverage is
📢 Thoughts on this report? Let us know!. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Maybe this should be defined only for RegressionModel
instead?
I also wonder whether we should even define a fallback definition X = modelmatrix(model); any(i -> all(==(1), view(X , :, i)), 1:size(X, 2))
like in GLM.jl.
Bump. |
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
Moved it to RegressionModel |
Btw, note that StatsModels started exporting hasintercept after I wrote this PR. Not sure if this makes it better or not to define it in StatsAPI |
How about adding a fallback definition as I proposed above? |
Ah, good point, that's JuliaStats/StatsModels.jl#281. I guess it makes sense to define it in StatsAPI too like the rest of the |
Thinking about it, it could be better to only have an empty definition here, so that we can define a fallback in StatsModels like this: function StatsModels.hasintercept(m::RegressionModel)
if formula(m) !== nothing
return hasintercept(formula(m))
else
X = modelmatrix(model)
return any(i -> all(==(1), view(X , :, i)), 1:size(X, 2))
end
end EDIT: a third possibility would be to add a fallback CC: @kleinschmidt @palday |
@nalimilan you need I like the idea of defining a |
@kleinschmidt What do you think? I find it relatively unlikely that a package would want to provide an alternative formula implementation. Now that we've decided to put |
This is useful to compute the correct degrees of freedoms to be used in t-test