Compare two linear regressions.

28 views (last 30 days)
Jorge Bonet Jara
Jorge Bonet Jara on 15 Oct 2020
Answered: Chrystalleni on 2 Nov 2023
I am trying to obtain voltage-magnetizing inductance curve for an induction motor. The curve is expected to be linear between 386 volts an 400 volts. I want to obtain this curve for two relative positions between stator and rotor, normal assembly (Curve A) and displaced assembly (Curve B). If the displacement is of 90%, it is expected that CurvB = CurvA*0.9. Voltage is measure directly using an oscilloscope and inductance is estimated through a optimization process using a mathematical model of the motor. This process is affected by the noise in voltage and current measurements.
Once I get the data from the two conditions, I remove outliers and then apply fitlm() for both of them. Now, I want to know if the linear regressions are significantly different. They are meant to be two parallel lines.
How can I do this in Matlab? Is there any function I can use ?
Thank you very much.
Jorge
  2 Comments
Jorge Bonet Jara
Jorge Bonet Jara on 15 Oct 2020
I'll explain myself better, just in case. Basically what I'm doing is comparing two sets of data. Data A: x1, y1 Data B: x2 , y2
These sets should fit theoretically:
yA=m+n*x1 for the first data set
yB=factor*(m+n*x2) for the second.
In this case factor=0.992 (in theory)
What I want to test/know is: if the two linear regressions I get using fitlm (one for each set) are statistically significantly different or in other words, if I could say that the change I made in the motor affected the original curve (data set A). To sum up:
what I want is to compare two linear regressions obtained using two sets of data (vectors x1, y1 and vectors X2 U2) (one for each regression) in order to know if the difference between regressions is statistically significant.
Jorge Bonet Jara
Jorge Bonet Jara on 15 Oct 2020
Edited: Jorge Bonet Jara on 15 Oct 2020
Here is the results of the fitlm function

Sign in to comment.

Answers (1)

Chrystalleni
Chrystalleni on 2 Nov 2023
I know it's been long since this question was posted, but I came accross the same question, so I thought to write my solution here in case other people ask. Graphpad is using ANCOVA to compare the slopes and intercepts of two regression lines, so I believe you could use the [h,atab,ctab,stats] = aoctool(...) MATLAB function.

Community Treasure Hunt

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

Start Hunting!