# Testing whether there is an increase between two regression slopes in a time series

I have a data of sea levels from a particular station from 1940 till today. The linear regression on the data from 1940-1980 resulted in a slope of 3. The linear regression on the data from 1980-2010 resulted in a slope of 4.

What test can be used to establish whether the increase in the slope is significant?

• What was the basis for breaking the regressions at 1980? The test depends on whether that point was determined somehow from the data--even if a non-statistical method was used--or represents information independent of the data.
– whuber
Feb 13, 2013 at 20:38
• It comes from a non-statistical, data independent, method (a colleague just suggested it). Feb 13, 2013 at 20:41
• But did the colleague have any information about the sea level data? For instance, if they simply had glanced at them at one point and suggested using 1980, that alone should change the p-value of any test by a lot!
– whuber
Feb 13, 2013 at 20:43
• No. Basically I'm a humble high school maths teacher and I had this idea to get such data from around the world (one station per pupil). A geography teacher suggested the date as a guide without having seen any of the data. Well, none of my data, maybe he has seen other data. Feb 13, 2013 at 20:47
• Some solutions have already appeared here, Geoff, because one approach is to treat the two parts of the data as separate and regress them separately. stats.stackexchange.com/questions/33013 and other threads explain how to do that. There are additional methods, such as including a binary dummy variable to indicate the post-1980 data. I suspect these, too, have been described here: you might find solutions under the change-point tag. Finally, many time-series questions address similar issues.
– whuber
Feb 13, 2013 at 20:51

I feel that after three years it does no harm to post my own answer to how I solved this problem. It could be the case I have made an error or two, so please use with a pinch of salt!

Following whuber's advice in the comments, since my data is a time series of heights we would expect a continuity of the height at the change-point (1980). So I recoded the data to be number of years from 1980, such that at 1980 it is 0, negative values are for dates prior to then and positive values post 1980.

Then I created two new variables: $before$ which contains the heights for the dates prior to 1980 and zero afterwards; and $after$ which contains the heights for the dates after 1980 and zero beforehand.

This means that I can view the data in the following way, with the intention of finding the plane of best fit.

Applying a multiple regression with these two variables as explanatory and height as response yielded the following:

$estimated\ height = 4.1\cdot before + 1.3\cdot after+7066$

and looks like this:

where the black line is a regression on the whole data set whereas the red kinked line is the model above. So my original question now becomes whether this kink is significant, by asking whether there is a difference between the slope of before compared to the slope of after.

Assuming I can use the relevant statistics obtained from the multiple regression, I followed this response to compute the test statistic:

$Z=\dfrac{b_{after}-b_{before}}{\sqrt{SEb_{after}^2+SEb_{before}^2}}$

which with my values gives $Z=3.95$ and from there I can continue to calculate the $p$-value depending on the direction of the hypothesis. (In my case I hypothesised an increase, but that doesn't appear to be the case!)

The tests that habe been suggested are limited to comparing the two slopes BUT the slopes could be the same and the two ontercepts could be different. The Chow Test http://en.wikipedia.org/wiki/Chow_test tests the significance of both coefficients not just the slope. Some software will actually find the breakpoint (if any ) rather than force the user to guess at the breakpoint. AUTOBOX a piece of software I am involved with actually does that. You can get a 30 day version to use on your problem at no cost. Nothing is cheaper than free !

• If you express the variables correctly, there is no issue concerning intercept: just let $x$ be years since 1980. Because sea levels are not going to change discontinuously, it is fair to ask the intercepts of the two regressions to agree with their common predicted value in 1980. The regression model is $y = \beta_0 + \beta_1 x + \beta_2 x*i + \varepsilon$ where $y$ is sea level rise, $x$ is years since 1980, $i$ is a $0$/$1$ indicator of time period (pre/post 1980), and $\varepsilon$ are errors. If this regression suggests the $\varepsilon$ may be iid, there may be no need to go any further.
– whuber
Feb 13, 2013 at 23:18
• I don't see how the test for B2 concerns itself with testing the constancy of B0 . Consider the following time series 1,2,3,4,5,6,21,23,25,27. Your procedure would not work. Now if the data was 1,2,3,4,5,7,9,11,13,15 then your approach would work since only the slope changed. In my first example both the slope and the intercept changed. Feb 14, 2013 at 21:51