I need to understand how one can calculate the confidence interval for linear regression. The values I got myself is different from the one with Matlab. So, I’ve been trying to understand how it is done in Matlab. In polyval.m, I don’t understand the part of the code below. It seems E is equivalent to [E,R] = qr(V,0). But not sure what it is exactly.
My questions are:
- How is
[E,R] = qr(V,0) different from [Q,R]=qr(V); -
How can
E(=V/R)be used to calculate the confidence interval (delta below)?% S is a structure containing three elements: the triangular factor of the Vandermonde matrix for the original X, the degrees of freedom, and the norm of the residuals.
E = V/R;
e = sqrt(1+sum(E.*E,2));…
delta = normr/sqrt(df)*e;
Thanks a lot!
Daisuke
I discuss this at some length in my optimization tips and tricks doc.
As for the difference in qr(V,0) to qr(V), that is what is called an economy qr. Read the help docs for qr.