I’m no data scientist, so it’s likely that my question does not make much sense… But here goes:
I recently tried to do some data analysis that involved fitting models. I’m able to fit the model, compute represent a prediction that it produces, but I’d like to also (compute and) represent confidence intervals for the model.
Here is my minimal (but incomplete) example:
using DataFrames data = DataFrame(x = rand(100)); data.y = 1 .+ 2*data.x .+ 0.1*rand(100); using GLM model = lm(@formula(y ~ x), data) pred = DataFrame(x = 0:0.01:1); pred.y = predict(model, pred); using Plots plot(xlabel="x", ylabel="y", legend=:bottomright) plot!(data.x, data.y, label="data", seriestype=:scatter) plot!(pred.x, pred.y, label="model", linewidth=3) savefig("/tmp/plot.png")
To rephrase (because I’m not even sure to use the correct words here): I’d like to represent the uncertainty about the model using a shaded area around the “model” curve.
Is there a (not too complicated) way to do that? Ideally, the solution should be as independent of the model as possible, because my real use-case involves more complex models…