2
$\begingroup$

I have a data set that has been collected by a set of empirical experiments. Having plotted them on a graph, it seems that the data behavior is linear. On the other hand, some colleagues claim that the data are not linear. How can I show them the confidence level of being linear for my data? In other words, is there any formal method for showing the linearity of data instead of plotting them?

$\endgroup$
4
$\begingroup$

Good old correlation explicitly measures the strength of a linear relationship. It's the perfect tool for what you need.Then again, if you get something like 0.6 it's hard to say one way or the other.

Failing that, you could estimate a linear regression. Then estimate whatever alternative model your colleague has in mind and see how well measures like (adjusted) R-squared, AIC/BIC, and RMSE improve. If the models are nested, run a nested F test. I'm personally a fan of plotting the residuals against your dependent variable. I find that it helps me look more objectively at what my model does by making it very obvious what my model does not do.

Another option is to use the Ramsey specification test. First run a regular linear regression and predict $\hat{y}$. Then estimate $y=\beta_0 + \beta_1x+\gamma\hat{y}^2+\varepsilon$ and run a nested F test. I know you can add in higher powers of $y$ as well but I'm personally not sure why that would help.

Better yet, think about whether a nonlinear relationship makes sense. What kind of data is it and what was your treatment? Is there an obvious alternative? Try plotting a line over it, and then plotting a quadratic/logarithm/loess or whatever over it. Does one make more sense than another?

$\endgroup$
3
$\begingroup$

This is easiest when you have a concrete alternative, for example the trend is linear or quadratic or the trend is linear or follows a (linear) spline. In the first case you would estimate a model with both the main effect and a quadratic term and test whether the null hypothesis that the quadratic term is 0. In the second case you would estimate a model with a linear spline, and test the hypothesis that the slopes in the different sections are all equal.

If you don't have such a concrete alternative then one possibility would be to use a very flexible family of curves of which the linear effect is one member. One option would be the fractional polynomials, as described in:

Royston, P., and D. G. Altman. 1994. Regression using fractional polynomials of continuous covariates: Parsimonious parametric modelling. Applied Statistics, 43(3): 429–467. http://www.jstor.org/stable/2986270

$\endgroup$
1
$\begingroup$

If you have the option of supplying canned inputs, you can look for frequencies in the output which are not present in the input. For example, put in sin(f*t), and if you get out any significant signal at 2f, 3f, etc... you have a nonlinearity!

$\endgroup$
1
$\begingroup$

Slide 5 of Data Analysis & Computers II attempts to answer your question in three different ways:

There are both graphical and statistical methods for evaluating linearity. Graphical methods include the examination of scatter plots, often overlaid with a trend line. While commonly recommended, this strategy is difficult to implement. Statistical methods include i) diagnostic hypothesis tests for linearity, ii) a rule of thumb that says a relationship is linear if the difference between the linear correlation coefficient (r) and the nonlinear correlation coefficient (eta) is small, and iii) examining patterns of correlation coefficients.

see also these links: https://stackoverflow.com/questions/3002638/eta-eta-squared-routines-in-r https://stackoverflow.com/questions/3013772/non-graphical-linearity-estimation

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.