Skip to content

Commit

Permalink
quick recipe for StatsModels
Browse files Browse the repository at this point in the history
Right now only works for the bivariate case
  • Loading branch information
mkborregaard committed Jan 30, 2020
1 parent a43fe45 commit d05cdf3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/StatsPlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ include("violin.jl")
include("hist.jl")
include("marginalhist.jl")
include("bar.jl")
include("statsmodels.jl")
include("dendrogram.jl")
include("andrews.jl")
include("ordinations.jl")
Expand Down
8 changes: 8 additions & 0 deletions src/statsmodels.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Note both predict and RegressionModel are defined in StatsBase
@recipe function f(mod::RegressionModel)
newx = [ones(200) range(extrema(mod.model.pp.X[:,2])..., length = 200)]
newy, l, u = predict(mod, newx, interval = :confidence)
ribbon := (vec(u)-newy, newy-vec(l))
label --> "model"
newx[:,2], newy
end

0 comments on commit d05cdf3

Please sign in to comment.