Uh oh!
There was an error while loading. Please reload this page.
add hasintercept - #17
Conversation
This is useful to compute the correct degrees of freedoms to be used in t-test
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #17 +/- ##
=========================================
Coverage 100.00% 100.00% =========================================
Files 2 3 +1 Lines 36 40 +4 =========================================
+ Hits 36 40 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nalimilan
left a comment
There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nalimilan
commented
Sep 6, 2023
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>
matthieugomez
commented
Sep 6, 2023
Moved it to RegressionModel |
matthieugomez
commented
Sep 6, 2023
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 |
nalimilan
commented
Sep 6, 2023
How about adding a fallback definition as I proposed above? |
nalimilan
commented
Sep 6, 2023
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)
ifformula(m) !==nothingreturnhasintercept(formula(m))
else
X =modelmatrix(model)
returnany(i ->all(==(1), view(X , :, i)), 1:size(X, 2))
endendEDIT: a third possibility would be to add a fallback |
palday
commented
Sep 6, 2023
@nalimilan you need I like the idea of defining a |
nalimilan
commented
Sep 7, 2023
@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