Is is possible to calculate the standard error estimation when using fit from curve fitting toolbox as in polyfit?
Suppose I have 2 vector (x, y). Using polyfit and polyval gives the standard error estimation for all predictions.
How to calculate delta in fit? I need the prediction interval like examples below.
I assume the delta in polyval is not a scalar but varies with x. (Purhaps it is not?)
Example from the documention,
x = 1:100;
y = -0.3*x + 2*randn(1,100);
[p,S] = polyfit(x,y,1);
[y_fit,delta] = polyval(p,x,S);
title('Linear Fit of Data with 95% Prediction Interval')
legend('Data','Linear Fit','95% Prediction Interval')