I am interested in doing a nonparametric hypothesis test in Stata. I have 2 series of data, each time series and that overlap in time period. 10 time periods each.

I am interested in a test that checks whether the series are trending similarly. I am not interested in the levels.

For example, suppose I have a series that happened to obey the equation: y = 2x + 100 and one that obeyed y = 2x + 1. They are clearly very different in level but identical in how they trend. I would want the test to fail to reject any difference in how they are trending in that case. If, however, the series obeyed y = 100, that is trending very differently from y = 2x + 100 despite the common point. Even if it is y = 150 intersects it. I would want the test to tell me that these two series are clearly trending differently.

Is there a nonparametric test for this? I was thinking of something like K-Smirnov, but I cannot seem to figure out how to apply it in Stata to the case at hand.

The alternative I've been doing is a linear regression of y on x for each series and then testing whether the coefficients are statistically different from one another just with the test command (storing the coefficients and then testing).


1 Answer 1


Although this is a time series problem. These series are simple functions of time. So you can just do a simple linear regression of the response on time. A test that the slopes are equal is your trend test. A test on the intercept coefficients being equal would handle your first case.

  • $\begingroup$ Michael Chernick: Thank you for your quick response. I agree with that solution. I have implemented that thus far. I am wondering whether I can do something that relaxes the linearity assumption. $\endgroup$ Commented May 13, 2012 at 22:38
  • $\begingroup$ The linear model allows polynomial and other nonlinear functions of the covariates, The restriction is linearity in the parameters. But if for example you have a quadratic function of time the trend is nonlinear and you can't think of the regression parameters as the slope of a trend line. $\endgroup$ Commented May 13, 2012 at 23:43
  • $\begingroup$ Do you mean regression of y on time and time squared? What is the test? $\endgroup$ Commented May 13, 2012 at 23:46
  • $\begingroup$ Each term in the polynomial has a regression coefficient that can be tested to see if it is statistically significantly different from 0. My point is that if t and t squared both have nonzero coefficients that are statistically significant, neither one can be considered ot be a linear trend. $\endgroup$ Commented May 14, 2012 at 0:01
  • $\begingroup$ I think I am no longer understanding. Suppose I have data for 2 countries: Germany and England. I thought your suggest is to regress the Germany data against time and collect the coefficient, then regress the England data against time and collect the coefficient, and then compare whether the coefficients are equal. In the quadratic example, then that would be a multi hypothesesis test? $\endgroup$ Commented May 14, 2012 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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