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

답변 (2개)

Honglei Chen
Honglei Chen 2012년 7월 26일

0 개 추천

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 2012년 7월 26일
편집: per isakson 2012년 7월 26일

0 개 추천

Search for "basic fitting" in the on-line documentation. I think that includes all what you need.

카테고리

도움말 센터File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

질문:

2012년 7월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by