[R] Measure of linearity between two variables?

Luke Whitaker luke at inpharmatica.co.uk
Thu Apr 17 18:02:36 CEST 2003


Hello,

I am looking for a measure of linearity in the relationship between
two variables.

Specifically, I have two variables for which the relationship is
reasonably linear over a certain range of values, and then diverges
from linearity at either end of the range, as one or other variable
"saturates" at a maximum or minimum value. I want to identify the
region of linearity, where neither variable has saturated.

This is a problem that will be repeated many times so I want a
programmatic solution.  I am intending to implement some kind of
search over the central range of values, expanding out and testing
for linearity over each incrementally increased range. However,
I need a measure if linearity.

So far, I have thought of doing a regression on x ~ y + y^2, and
using the absolute value of the ratio of coefficients of the squared
and linear terms. Does anyone have any better ideas, either for a
linearity measure or a different approach to finding the region of
linearity between the two variables ?

Thanks,

Luke Whitaker



More information about the R-help mailing list