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
Fix predict with confidence intervals #253
Conversation
f1a0669
to
49fe437
Compare
Codecov Report
@@ Coverage Diff @@
## master #253 +/- ##
=========================================
- Coverage 51.97% 51.7% -0.28%
=========================================
Files 6 6
Lines 583 588 +5
=========================================
+ Hits 303 304 +1
- Misses 280 284 +4
Continue to review full report at Codecov.
|
Wonderful. I also agree wholeheartedly with the name change. |
Does this mean this will work with DataFrames now? There was a PR on DataFrames I never got merged... |
Do you have a link? It must have worked at some point, since it's in the examples, but I wonder since when it's been broken. |
I don't think it's ever worked from DataFrames... |
I'll rebase and write the test if that's still doable, but I'm guessing the interface has changed a lot? |
Thanks. Actually I now realize I hadn't tested the example based on DataFrames correctly. The test in runtests.jl only covers matrices. So this PR shouldn't be merged without fixing The code now lives in StatsModels.jl. If we make interval-related arguments keyword arguments rather than positional, I think we can avoid defining a separate function as in JuliaData/DataFrames.jl#1160. Instead, you can just check whether |
Or here in GLM? |
Yes, in StatsModels. GLM should be ready with this PR. |
By the way @nalimilan I just rememembered that the way I implemented it like it is, and not with a keyword as in this PR, is because the keyword version breaks type stability of |
AFAIK type-stability isn't a problem anymore with keyword arguments: julia> f(; x=nothing) = x === nothing ? 1 : 1.0
f (generic function with 1 method)
julia> @code_warntype f()
Body::Int64
[...]
julia> @code_warntype f(x=nothing)
Body::Int64
[...]
julia> @code_warntype f(x=1)
Body::Float64
[...] |
sweet 🎉 |
Use keyword arguments, which are passed through by the DataFrameRegressionModel method.
I've pushed a commit to change the names. Is this good to go? IIRC a separate change is needed in StatsModels to support DataFrames, but that's already broken currently. |
Yes, I'll have a look a StatsModels some time during the week |
@nalimilan I can't see that the name has been changed? It still says Here's the StatsModels PR: I have a question - we currently return a three-row Matrix as |
Oh, I see we already discussed the tuple thing once: #171 (comment) |
d7cc9c2
to
c2a5bd2
Compare
Woops, I had just forgotten to push the new commits. |
I've added prediction intervals in a PR against this branch |
Use keyword arguments, which are passed through by the DataFrameRegressionModel method.
While we're at it, I wonder whether we should change the API a bit.
interval=:confint
andinterval=:predint
could be changed tointerval=:confidence
andinterval=:prediction
, which are the names used by R (since "int" is redundant withinterval
).Cc: @mkborregaard