Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

standard error of the estimate from polyval?

1,180 views
Skip to first unread message

Mike

unread,
Apr 7, 2009, 10:42:05 PM4/7/09
to
Hi

In the following:

x=[1 2 3];y=[2 3.9 6];
[p,S]=polyfit(x,y,1);
[yp,delta] = polyval(p,x,S)

yp =

1.9667 3.9667 5.9667


delta =

0.1106 0.0943 0.1106

>> y-yp

ans =

0.0333 -0.0667 0.0333

I'd like to estimate standard error of the estimate between y and
predicted y by linear regression, but find that delta is not y-yp.
In manual, it says "[y,delta] = polyval(p,x,S) and [y,delta] = polyval
(p,x,S,mu) use the optional output structure S generated by polyfit to
generate error estimates, y±delta. If the errors in the data input to
polyfit are independent normal with constant variance, y±delta
contains at least 50% of the predictions." I don't understand this.

Mike

Peter Perkins

unread,
Apr 7, 2009, 11:01:26 PM4/7/09
to
Mike wrote:

> In manual, it says "[y,delta] = polyval(p,x,S) and [y,delta] = polyval
> (p,x,S,mu) use the optional output structure S generated by polyfit to
> generate error estimates, y�delta. If the errors in the data input to
> polyfit are independent normal with constant variance, y�delta
> contains at least 50% of the predictions." I don't understand this.

Mike, I don't know what version you're using. The command line help for polyval in the current version says this:

DELTA is an estimate of the standard deviation of the error in
predicting a future observation at X by P(X).

If the coefficients in P are least squares estimates computed by
POLYFIT, and the errors in the data input to POLYFIT are independent,
normal, with constant variance, then Y +/- DELTA will contain at least
50% of future observations at X.

for some reason, the HTML reference page does not have that first part of the description. I've made a note to have that fixed.

By the way, the 50% comes from a worst-case scenario of 1 error degrees of freedom for a t-based confidence interval. In most cases, +/- delta will be closer to a 68% prediction interval.

Hope this helps.

Mike

unread,
Apr 9, 2009, 1:15:51 AM4/9/09
to
On Apr 8, 11:01 am, Peter Perkins

Oh... I though help from HTML and command will be the same.
I don't find "DELTA is an estimate of the standard deviation of the
error in
> predicting a future observation at X by P(X)." in HTML.
My version is R2009a, the latest one.

thank you.

Mike

0 new messages