I’m pretty new to Data Science.
I have some Data with measurement errors and I want to fit a linear model.
using DataFrames using GLM using StatsPlots df = DataFrame(x = [0.0, 0.0669873, 0.25, 0.5, 0.75, 0.933013, 1.0], y = [0.223, 0.291, 0.393, 0.549, 0.73, 0.85, 0.896], u_y = [0.023, 0.024, 0.027, 0.031, 0.037, 0.041, 0.043]) # Weighted Least Squares wlr = glm(@formula(y~x), df, Normal(), wts = 1 ./ df.u_y.^2) x_interval = DataFrame(x = 0:0.01:1); pred = predict(wlr, x_interval, interval = :confidence) @df df scatter(:x, :y, yerror = :u_y) plot!(x_interval.x, pred.prediction, ribbon = (pred.prediction .- pred.lower, pred.upper .- pred.prediction))
I get this result:
The confidence interval should get plotted but it is so small that you can’t even see it.
Shouldn’t it be as wide as the measurement errors?
How do I fit it accordingly?
Thank your for all answers and have a nice day