Let's consider I am measuring Y over time t.

If the relationship between t and Y was roughly linear, and I wanted to check whether Y increases with t, I would ordinarily plot a linear regression and set up the hypothesis test H_0: slope = 0 and H_A = slope > 0, which I might conduct at say the 95% significance level (assuming independence).

However, what would do I in the circumstances in which the dataset is not obviously linear? I have a lot of data which has no obvious pattern (at least which I could reasonably model at the granular level using Excel), but I want to check whether there is a long term increase of Y over time, irrespective of this pattern.

My idea

I was thinking of calculating the Spearman's Rank, but I'm not sure if this is the best way to check this. How would I know if the result is "significant", and couldn't have reasonably occurred out of chance? Can I test for this?

I was also thinking of plotting a linear regression through the dataset anyways, but I don't think I can do this because the residuals don't satisfy the assumptions necessary to set-up the statistical model (and so any P-values would be meaningless)

Thank you

  • $\begingroup$ I think the term "increasing over time" should be defined more precisely. It could mean 1) that the slope is negative more often than positive, or 2) that y and t are positively correlated, 3) that y is at a significantly higher level at some time T than it was at time 0, or 4) that y goes to infinity. When the relationship between y and t is linear, all four meanings have the same answer, but without the linearity assumption, they could easily have different answers. $\endgroup$
    – svendvn
    Mar 28, 2023 at 21:37

2 Answers 2


Question: Is $y_t$ increasing over time?

One proposed solution: Use Spearman's rank correlation coefficient $r_{\text{S}}$ measured between $y_t$ and $t$, and test $\text{H}_{0}\text{: }\rho_{\text{S}} \le 0$ versus $\text{H}_{\text{A}}\text{: }\rho_{\text{S}} > 0$. If you reject $\text{H}_0$ in favor of $\text{H}_{\text{A}}$, that is evidence that $y_t$ is increasing monotonically.


Perhaps some sort of ad-hoc nonparametric test?

Randomly select some $t_1 < t_2$, check whether $Y(t_1) < Y(t_2)$. Repeat.

Edit: In case it wasn't clear, you can test the above against the "null hypothesis" that $P(Y(t_1) < Y(t_2)) = .5$. The null should (I believe) follow a Bernoulli distribution.

Edit 2: Per advice from a friend, you could also do a permutation test to generate a p-value for the Spearman coefficient (i.e. shuffle all of the $t_n$, re-calculate the Spearman coefficient, repeat).

  • $\begingroup$ Hey thanks so much for the response! To check if I'm understanding the "Edit 2" - are we saying continually recalculate the spearman rank by bootstrapping the sample? $\endgroup$ May 17, 2021 at 15:24
  • $\begingroup$ I'm not sure you need to "bootstrap" - that usually implies subsampling, but if we have enough computation power to run the spearman rank on the whole function then there's no reason to leave out any of the data. Instead, just shuffle your whole set of measurements and calculate the spearman coefficient on the shuffled set. If you do this enough, you can then use the empirical distribution of the computed spearman ranks to determine a p-value. $\endgroup$ May 17, 2021 at 15:28
  • $\begingroup$ Bootstrapping does not generally imply subsampling. Bootstrapping is resampling which is taking a # of random samples with replacement of size S from the sample (which is of size=S). Subsampling involves a sample size of s<S and without replacement. $\endgroup$
    – LSC
    Mar 28, 2023 at 21:09

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.