# How to tell if a trend seen in multiple data sources is significant?

Let's say I have several stations which measure temperature vs. time each hour for several years. Due to noise, when I plot the temperature vs. time from any one station, it's hard to see a trend. (The source of the noise could be sensor noise, or short-term variability due to storms etc.) However if I average all stations at each time step and plot the resulting mean vs. time, it seems there is a linear trend. How can I test if this common trend is significant? I know I can perform a t-test, but how do I include the number of stations, since my result is more reliable if it seen across 100 stations than across 10?

• Hi. Have you considered stacking your observations and fitting a linear regression? You could even assess trends across groups. It may give you more flexibility. Commented Apr 10, 2020 at 13:30
• Not clear about whether you want to test for a trend (for instance, an upward trend which may be more pronounced in some stations and less on others) or for the existence of a common trend. In the later case you might want to google for "cointegration". In either case, I think state-space modelling might be indicated. Commented Apr 10, 2020 at 16:23
• @F.Tusell - I am looking for a common trend seen across all the stations, so I edited the question.
– KAE
Commented Apr 10, 2020 at 17:13

Lots of ways you could model this. It'll help to start with a consistent notation. Temperature at place $$i$$ at time $$t$$ is $$T_{it}$$.

The simplest thing that you could do could be to fit a linear regression to the pooled data:

$$T_{it} = \alpha + \beta t_{it} + \epsilon_{it}$$

You'll need to reshape your data to have the form

place  time  temp


Which is to say from wide to long -- each row is one place at one time.

Standard linear regression machinery in your preferred software can do inference on the coefficients.

There are slightly more sophisticated models that account for the fact that your data is a panel, but I don't think that you really need them for simply testing the significance of a trend.

• The only independent variable in the model is time, not space, which is what I want. Is there any advantage to averaging all the different locations prior to fitting the time trend, or just fitting a time trend to all locations' time series at once, as you propose?
– KAE
Commented Apr 10, 2020 at 18:07
• Why have you assigned a slope for time at a given time? Also I disagree that hierarchical linear modeling (if that is what you meant) is only slightly more sophisticated than vanilla linear regression. I can see why you thought HLM might not be necessary here, though it still could be helpful to describe that approach at least in a few lines. Commented Apr 10, 2020 at 20:21
• Though we have a multilevel structure, I don’t think this answer is suggesting the OP run a hierarchical linear model, which is a rather advanced technique. Rather, the answer suggests the OP run a ‘pooled’ ordinary least squares regression with a variable for time. We could drop the $i$ subscript on the time variable as it won’t vary by group (station). The variable $t$ could simply be a continuous linear time index. Commented Apr 11, 2020 at 3:24
• @ThomasBilach , you are correct, I am seeking a linear trend vs time that is apparent across all the stations. I don't want to know if it is stronger at some stations and weaker at others; rather I want to estimate one trend in temperature vs. time, as seen across all the stations.
– KAE
Commented Apr 13, 2020 at 20:53