From d05cdf3f6cb0eacf914d54b9a80e394c1baeedbb Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Wed, 29 Jan 2020 17:06:09 +0100 Subject: [PATCH] quick recipe for StatsModels Right now only works for the bivariate case --- src/StatsPlots.jl | 1 + src/statsmodels.jl | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 src/statsmodels.jl diff --git a/src/StatsPlots.jl b/src/StatsPlots.jl index 4efeefe..15104e3 100644 --- a/src/StatsPlots.jl +++ b/src/StatsPlots.jl @@ -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") diff --git a/src/statsmodels.jl b/src/statsmodels.jl new file mode 100644 index 0000000..fa52f07 --- /dev/null +++ b/src/statsmodels.jl @@ -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