Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How to compare the standard errors

Asked by Lizan on 22 Nov 2012

Hi,

I have implemented a code for the slope,

x_ceng = sum(xi)/n; % center of gravity of x

m = sum(xi-x_ceng)*yi/sum(xi-x_ceng)^2; % Slope

di = yi-m*xi-c; % the residuals

D = sum(xi-x_ceng)^2;

% The standard error is then given by;

dm = sqrt(sum(di^2)/D*(n-2))

I have compared m with values of polyfit and it agrees, but I am not certain that the standard error is correct. I am obtaining very low dm that what I would like considering the spread of the data that I obtain.

Is there any function in MATLAB that I can compare dm with?

Many Thanks for any input.

3 Comments

Star Strider on 22 Nov 2012

If you are estimating two parameters, you should have two standard errors, one for each parameter.

Also, your dm line doesn't look correct to me.

Lizan on 23 Nov 2012

I am curious what is it in eq."dm" that does not look correct for you?

Star Strider on 23 Nov 2012

Initially, there was a right parenthesis missing. (You corrected that in your edit.)

The polyfit documentation outlines a procedure to calculate the covariance matrix from information in the ‘S’ structure, and from that you can calculate the standard errors to check to see how they compare to those you calculated in your code.

Lizan

Products

1 Answer

Answer by Star Strider on 23 Nov 2012

If you want to determine the parameter confidence intervals from polyfit, I suggest the File Exchange function polyparci.

0 Comments

Star Strider

Contact us