# Test to show when diverging linear regression models are statistically different

What method will allow me to identify the values of the independent variable where two (or more) diverging linear regression models are statistically different?

e.g. Take two simple linear regression models derived from some experimental test: $y_1 = -1x+100$ and $y_2 = -0.5x+100$. These could represent two time points on a dose vs survivorship relationship, or two different materials in a temperature vs strength relationship.

At $x = 0$ the two models give the same $y$. As you move away from $x = 0$ the values of $y_1$ and $y_2$ diverge, however for some period their confidence intervals will overlap suggesting that $y_1$ is indistinguishable from $y_2$ in this region. Taking the temperature vs strength relationship as an example, this suggests that there is no difference in strength of the two materials over this temperature range. Therefore, I would like to be able to calculate this range, or conversely identify the range of $x$ values when $y_1$ is statistically different to $y_2$.

My understanding of predictions bands is not great, but I don't think this is the solution.

The only solution I can come up with is to calculate the $y$'s and CI's at discrete values of $x$ and run a series of tests. I am looking for something more elegant!

• Could you please provide context, details, and an explanation of what you mean by "diverging" and "significantly different" regression models?
– whuber
Mar 21, 2013 at 16:36
• I think it would help to phrase the question without using the term "significantly". What do you really want to know? Mar 21, 2013 at 18:31
• Re the edit: the answer depends on whether the two models have any data in common or not.
– whuber
Mar 21, 2013 at 18:59
• I think you might be interested in prediction bands Mar 21, 2013 at 22:38
• Isn't this just a parallel slopes question? do you want to know if the slope is the same in the two groups? Just put an interaction term in the model, and look at the parameter test for the interaction term Mar 22, 2013 at 14:12

This paper, by Bauer and Curran, sounds like it might be what you want. http://www.unc.edu/~curran/pdfs/Bauer&Curran(2005).pdf This page has a calculator, which helps. http://quantpsy.org/interact/mlr2.htm

You calculate an area of significance. If you have two groups which have a regression slope, you can calculate the points at which they are significantly different.

Here's a toy example, generating some code in R:

set.seed(1234)
x2 <- c(rep(0, 50), rep(1, 50))
x1 <- rnorm(100)

y <- 1 * x1 + 1 * x2 + 1 * x1 * x2 + rnorm(100)

myModel <- lm(y ~ x1 + x2 + x1 * x2)
summary(myModel)
vcov(myModel)


Then it runs a regression, with the interaction. The vcov() gets the variances and covariances of the parameters, which you need for the analysis. Plug those numbers into the web page, and it writes some R code, which draws the following graph:

The plot shows the values of x1 on the x-axis, and the difference between the two groups as defined by x2 on the y-axis. So at x1 = 0, there is a small positive effect of x1. At x1 = 5, there is a larger effect, and at x1 = -5 the effect is flipped and there is a negative effect of x2. The red lines show the CIs, and the vertical blue lines define the regions of significance.

• This is a great answer, curious to know if there are alternative techniques though. Dave.
– dave
Mar 28, 2013 at 13:29