1
$\begingroup$

With

data = {{0.002, 2.51053}, {0.004, 2.54217}, {0.006, 2.55543}, {0.008, 2.54247}};

I obtain a linear fit 2.51038 + 5.454 x; now I want to get the 95% confidence interval from linear regressions. when I do it with Mathematica, it gives me a pair of data set for the CI. I want to add the CI to x -> 0.000717263, but I don't know how to interpret that.

$\endgroup$
2
  • $\begingroup$ The size 4 of your data is too small to make reliable estimates, e.g. see researchgate.net/post/… . $\endgroup$ – user64494 Jul 27 '20 at 6:39
  • $\begingroup$ Pay your attention to the result of glm = GeneralizedLinearModelFit[data, x, x] glm["ParameterTable"]$$ \begin{array}{l|llll} \text{} & \text{Estimate} & \text{Standard Error} & \text{z-Statistic} & \text{P-Value} \\ \hline 1 & 2.51038 & 0.019372 & 129.588 & 0. \\ x & 5.454 & 3.53682 & 1.54206 & 0.123058 \\ \end{array}$$ $\endgroup$ – user64494 Jul 27 '20 at 8:33
2
$\begingroup$

Is this what you want?

data = {{0.002, 2.51053}, {0.004, 2.54217}, {0.006, 2.55543}, {0.008, 2.54247}};

lm = NonlinearModelFit[data, a x + b, {a, b}, x]

bands[x_] = lm["MeanPredictionBands", ConfidenceLevel -> .95]

Show[ListPlot[data], 
 Plot[{lm[x], bands[x]}, {x, 0, 0.01}, Filling -> {2 -> {1}}], 
 Frame -> True, Axes -> False, PlotRange -> All]

enter image description here

bands[0.000717263]

{2.44077, 2.58781}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.