How can I perform a linear regression analysis with the equation y=a(x-b)?

Hi
I am new to MATLAB.
I don't have access to the statistics toolbox but I would like to perform a linear regression on my data but I need the x intercept (and standard error of the intercept) so need to use the linear equation in the form y=a(x-b) rather than y=ax+b. If I could get the r squared value for the fit too that would be great.
Thanks for your help Gavin

Respuestas (2)

Honglei Chen
Honglei Chen el 26 de Jul. de 2012
This is essentially the same as fitting y=ax+b since it can be written as y=ax+b=a(x-(-b/a)). So all you need to do is to fit y=ax+b and then do the conversion. You can use polyfit to do the fit of y=ax+b.
per isakson
per isakson el 26 de Jul. de 2012
Editada: per isakson el 26 de Jul. de 2012
Search for "basic fitting" in the on-line documentation. I think that includes all what you need.

Categorías

Más información sobre Linear and Nonlinear Regression en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 26 de Jul. de 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by