Warning: The result at the end is very anticlimactic.
While you’ve stated that your model has an intercept of zero the model that @JasonB is assuming with the particular use of LinearModelFit
is the following:
$$y_i=a+b x_i+ϵ_i$$
with $ϵ_i\sim N(0.2^2)$. Besides having an intercept (potentially not equal to zero), this model assumes that there is only measurement error (without any lack-of-fit error) and that the standard deviation of the measurement error is known (and therefore doesn’t have to be estimated).
If the plus-or-minus numbers that you give for the y-values are really known measurement standard deviations, possibly a more appropriate model is the following:
$$y_i=b x_i+ϵ_i+γ_i$$
where $ϵ_i\sim N(0.2^2)$ are the measurement errors and $γ_i\sim N(0,σ^2)$ are the lack-of-fit errors (i.e., deviations from the line when there is no measurement error) with the errors being independent of each other. (And I acknowledge that performing this more complicated model on only 5 data points is not really recommended. I offer this only as an example that would be used with many more data points.)
While in this case the estimate of the slope won’t change much at all if one fits
$$y_i=b x_i+ϵ_i+γ_i$$
or one fits
$$y_i=b x_i+ϵ_i$$
It is the estimate of the standard error of the slope that has the potential to change. One is trying to characterize and use all the information that is available to obtain appropriate estimates of both the parameters and an associated measure of precision.
LinearModelFit
and NonlinearModelFit
only allow a single error term with a specific functional form so one way to fit this model with the structure of the model and the data available is to find the maximum likelihood estimates using the LogLikelihood
function. The variance of $y_i |x_i$ ($y_i$ given $x_i$) is $0.2^2+σ^2$ so the log of the likelihood function is
logL = Simplify[LogLikelihood[NormalDistribution[0, ((1/5)^2 + σ^2)^(1/2)],
data[[All, 2]] - b data[[All, 1]]]]
FindMaximum[logL && σ >= 0 , {{b, 0.84}, {σ, 0}}]
(* {2.7525, {b -> 0.84, σ -> 0.}} *)
So our estimate of $\sigma$ is zero. To look into this further suppose we ignored the “known” measurement standard deviation and use the standard approach for fitting a line through the origin:
lm = LinearModelFit[data, x, x, IncludeConstantBasis -> False];
lm["EstimatedVariance"]^0.5
(* 0.110554 *)
lm["ParameterTableEntries"]
(* {{0.822222,0.0233069,35.27811,3.853070 * 10^-6}} *)
lm["ParameterConfidenceIntervals"]
(* {{0.757512,0.886932}} *)
We get an estimate for the the slope of 0.822222 and an estimated standard deviation about the line of 0.110554 which is about half of the “known” standard deviation. So you might not know what you think you know. (If what you presented in your original question was +/- 2 standard deviations, then you're right on the money.)
The estimated standard error for the slope is 0.0233069. A 95% confidence interval for the slope is {0.757512, 0.886932}. If want just to use the estimate plus-or-minus one standard error, then that should be labeled with very similar words. (There is no such thing as a "min-max for slope".)
Fit
andLinearModelFit
? $\endgroup$