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!. |
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.
|
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
endEDIT: 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