This is similar to this question.
The fitted line can be plotted alongside with the data with this code:
Show[ListPlot[data], Plot[lm[x], {x, 0, 5}]]
I would like to include a band around this line indicating the average error. How can I do this?
Example data:
{{0.300369, 0.316832}, {0.450271, 0.485149}, {0.327772, 0.435644}, {0.573727, 0.594059}, {0.966333, 0.940594}, {0.5,0.356436}, {0.648136, 0.663366}, {0.830708, 0.831683}, {0.932212,0.950495}, {0.616441, 0.663366}, {0.616441, 0.613861}, {0.351864,0.415842}, {0.858684, 0.881188}, {0.626629, 0.554455}, {0.781502,0.841584}, {0.24901, 0.178218}, {0.776995, 0.811881}, {0.327772,0.405941}, {0.288312, 0.336634}, {0.60677, 0.663366}, {0.81564,0.811881}, {0.5, 0.455446}, {0.5, 0.60396}, {0.0592884,0.108911}, {0.951739, 0.940594}, {0.376411, 0.346535}, {0.5,0.435644}, {0.288312, 0.346535}, {0.781502, 0.831683}, {0.5,0.485149}, {0.5474, 0.584158}, {0.990885, 0.980198}, {0.376411,0.435644}, {0.937525, 0.980198}, {0.5, 0.455446}, {0.763858,0.841584}, {0.845342, 0.821782}, {0.616441, 0.70297}, {0.0158381,0.039604}, {0.836982, 0.881188}, {0.634059, 0.683168}, {0.258183,0.277228}, {0.867029, 0.80198}, {0.937525, 0.910891}, {0.130091,0.168317}, {0.971463, 0.990099}, {0.5, 0.455446}, {0.782699,0.792079}, {0.60314, 0.60396}, {0.977697, 0.960396}, {0.81564,0.90099}, {0.60677, 0.623762}, {0.39686, 0.455446}, {0.573727,0.574257}, {0.4526, 0.435644}, {0.5, 0.455446}, {0.236142,0.346535}, {0.5, 0.514851}, {0.60314, 0.584158}, {0.648136,0.693069}, {0.426273, 0.554455}, {0.373371, 0.465347}, {0.60314,0.524752}, {0.60677, 0.534653}, {0.383559, 0.524752}, {0.300369,0.277228}, {0.895366, 0.950495}, {0.426273, 0.455446}, {0.39323,0.29703}, {0.320827, 0.39604}, {0.979305, 0.990099}, {0.19846,0.207921}, {0.951739, 0.980198}, {0.0141859, 0.019802}, {0.265205,0.316832}, {0.783454, 0.831683}, {0.351864, 0.366337}, {0.763858,0.792079}, {0.648136, 0.673267}, {0.763858, 0.762376}, {0.678731,0.693069}, {0.376411, 0.376238}, {0.5, 0.514851}, {0.70727,0.712871}, {0.763858, 0.772277}, {0.5, 0.574257}, {0.258183,0.386139}, {0.893117, 0.831683}, {0.478985, 0.376238}, {0.104634,0.168317}, {0.235301, 0.188119}, {0.727486, 0.851485}, {0.327772,0.277228}, {0.5, 0.425743}, {0.648136, 0.712871}, {0.161454,0.158416}, {0.812018, 0.772277}, {0.365941, 0.39604}, {0.426273,0.485149}, {0.478985, 0.49505}}
lm = LinearModelFit[data, x, x]
Show[ListPlot[data, Plot[lm[x], {x, 0, 1}, PlotStyle -> Red], AxesOrigin -> {0, 0}]









