-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
How does one put trendlines with confidence intervals on plots? #340
Comments
'smooth = true' right now should give you a linear regression line. On Friday, June 17, 2016, mkborregaard [email protected] wrote:
|
Awesome, I will give that a think. What about smooth being an object, initialised with Smooth() that could have a formula kwarg or accept a fitted object from e.g. a glm - confidence intervals could be set by a kwarg too. This is not too dissimilar to how ggplot2 in R does it: http://docs.ggplot2.org/0.9.3.1/stat_smooth.html |
What I mean is, maybe a smoother should be just another object type to add to the plot, with the same status as a line or points. And that smoother could be defined in different ways (formulas, a fit object, or a default formula), which would make it intuitive and fit well with the philosophy of Plots (I think). |
To fit within the philosophy of Plots, whoever has smoother packages should just make a type recipe for the smooth data type, and a series recipe with essentially just makes their type from the input data and plots it. Here are some candidate packages I could find: Loess.jl Should open up issues and suggest a type recipe (with a link pointing to the ecosystem page to show what that would entail). |
I see the logic there. Still, I would find it convenient if Plots provided trendlines out of the box, while still having the possibility of using objects from smoother packages via a plot recipe. (Note - using those objects to plot a smoother is perhaps tricky, i.e. it is a requirement for most plot types that the object has a single dependent and a single independent variable.) It would really be convenient with an in-Plots version of a smoother. I think the interface could work nicely and intuitively with a magic argument |
Someone could gather a bunch of series recipes for this in a SmoothPlots package, kind of like what Tom has going on for StatPlots |
why not use the StatPlots package as a home for this? |
Yeah, that's probably a better idea. |
Well, depending on what functions are used it could add more dependencies. How lean should StatPlots be? |
I agree - this would work well as part of the StatPlots package. I hope that shouldn't be too lean - would be nice with a powerful package for statistical plots. |
@ChrisRackauckas reminded me of this issue. You can now plot objects from the KernelDensity package (using StatPlots). This doesn't get you all the way of nonlinear smoothers built in to Plots. I'm open to API ideas that are loaded when StatPlots is loaded, however I don't plan on offering nonlinear smoothers in core Plots. |
But what about basic linear models (including polynomials)? I find that is used a lot more than moving average smoothers for most applications. I know you have single-order linear models implemented with |
I could see big expansion through StatPlots... just not in Plots. Like I said, I could use help in design. Give me some commands that you wish existed, along with desired output, and we can try to make it happen. |
As agreed here, the way is to go through StatsPlots. E.g. JuliaPlots/StatsPlots.jl#293 |
Hi,
I cannot seem to find in the documentation how one would put trendlines/smoothers in plots. In theory it might be possible to pass a fit object from a GLM with a recipe, but has it been implemented? Also, it would be even more awesome if it could put confidence intervals (e.g. as a grey/coloured box like ggplot2 in R does) automatically on the plot.
Thanks!
The text was updated successfully, but these errors were encountered: