How Can I Determine the Linearity of Experimental Curves in Statistics?

Join the discussion
Registration is free. Start your own thread to ask a follow-up.
3 replies · 2K views
roam
Messages
1,265
Reaction score
12

Homework Statement



I have two different experimental curves, and I would like to measure how closely a straight line fits each data, and which curve is more crooked. In statistics how can I measure this "linearity"?

By the way this is about stepper motor step linearity (ideally it has to be a straight line i.e. homogeneous step sizes). I am comparing the two plots made for two different speeds:

1582o3.jpg

Homework Equations

The Attempt at a Solution



I'm new to stats and I'm not sure what method to use. I'm very confused because some websites say I have to calculate the ##R^2## value, while others say I need a some kind of regression line. :confused:

So, if the linearity could somehow be determined from the equation of regression line, what kind of regression do I need to use (linear or quadratic, cubic, etc)? And how exactly do I determine linearity from that equation?

Any explanation is greatly appreciated.

P.S. I am using Matlab.
 
Physics news on Phys.org
roam said:
I'm very confused because some websites say I have to calculate the R2R^2 value, while others say I need a some kind of regression line.

I am not sure of the nomenclature, but I assume R2 is just a correlation coefficient, which in this case is a measure of how good the linear regression is. Two sides of the same coin.
 
  • Like
Likes   Reactions: roam
Borek said:
I am not sure of the nomenclature, but I assume R2 is just a correlation coefficient, which in this case is a measure of how good the linear regression is. Two sides of the same coin.

Thank you for the clarification. A high ##R^2## is what I think I will need to show good linearity.
 
R2 may be one way to do it but remember that is just a measure of how "far" away your linear fit is from the data (in the R2 it is squared to get rid of negative numbers and somehow normalized such that a perfect fit gets you a value of 1). You can have a lower R2 from noisy data which are still linear or from data which are not described well by a linear equation. What I would do is to fit a line, calculate the residuals, then either show the residuals are just noise with respect to the independent variable (this would just be a plot showing that there is no pattern to the residuals) or you can make a histogram/frequency plot of the residuals and show that they follow a gaussian/normal type of distribution.

It all depends on how far you want to go to show the linearity of your data (sometimes just plotting your line and data on the same graph is enough).
 
  • Like
Likes   Reactions: roam