# How to measure similarity/agreement between two temperature time series? [closed]

I am developing an application to compare temperatures from two locations, in the same span of time.

For example, temperature is measured every hour for three months straight in two different cities.

What would be a good way to compare these two data sets, and to come up with a agreement measure? What I am asking for is some measure of how identical or different the temperatures are. For example, if at 11 o'clock in a certain day in Oslo it is 3 degrees and in Athens it's 26 degrees, they would be markedly different, while if the temperatures were 23 and 21 degrees, respectively, we would consider them to be closer to the same measurement for these two cities. What I desire is to compare the lists of temperatures to make a combined report of how these temperatures agree/disagree overall.

• Please explain what it means for two temperatures to be "similar," if it is anything other than equal.
– whuber
Apr 5 '18 at 16:55
• All outside temperatures going to have daily cyclicality, and will look similar in that regard Apr 5 '18 at 16:57
• @whuber Thanks for pointing that out. I edited the question. Apr 5 '18 at 19:01
• As you're aware, similarity or more precisely dissimilarity between temperatures is measured as a difference. (That may seem obvious, but there are many variables where it's arguable that a ratio or something else is a better scale for comparison.) So far so good, but what else are you asking? The more places differ in location, the more cycles of daily and seasonal variation will differ, all the way down to phase differences as well as amplitude differences. More positively, additive shift is often a very good first approximation for nearby places. Apr 6 '18 at 11:52
• "What would be a good way"...clearly there are multiple ways emerging, so can you specify what your definition of "good" is? Otherwise I'm afraid the thread is going to be closed as too open-ended. Though maybe it seems people are spending more time evaluating your question than answering it :-( Apr 6 '18 at 15:05

Edit after OP edit and user comments, downvoters should reconsider their opinions, please. This is currently an accepted answer, one user has removed his downvote. Downvoting without leaving a comment is not constructive at this point.


I did not at first see the OP edit while I was answering. There are no really good answers to the question. What there is is a simplest answer to the question; to look up or calculate directly the mean temperatures in both locations, and then subtract them to find an expected difference in temperature at any particular time on any particular day. Mean temperatures require approximately 10 years of data to establish that mean, and or a time series like ARIMA. Three months of data from a single year would not be as useful. Next most useful would be regression, next most useful would be correlation. Agreement would not be a very useful measure because it is not information rich enough to explain how the temperatures covary. Details follow.

A squared correlation coefficient is called the coefficient of determination. The coefficient of determination, symbolically $r^2$, would give the fraction of variance between temperatures that is mutually explained, and occurs at the same time.

I found daily average temperatures compiled during 2010 for Augusta, Maine and Miami, Florida. Here is a chart: The correlation is $r=0.990128135$ and the coefficient of determination is $r^2=0.980353723$. The 2261 km distance between those cities is similar to the 2607 km Athens to Oslo distance. Like Athens and Oslo, Miami and Augusta are in the same time zones, meaning that the daily temperature highs and lows will be correlated positively so that if hourly data were readily available, that would correlate. Now if unique measurements rather than averages were included, that may lower the coefficient of determination, nonetheless the correlations are higher than even I suspected. Note on the chart that there is a doubled hysteresis loop presumably largely due to the difference in timing of temperature modification by the proximity of the Labrador current in Maine, and the Gulf stream current for Miami.

One can convert between Miami and Augusta temperatures using bivariate regression, i.e., using Passing-Bablok invertible (unlike OLS) regression $F(Miami)= 0.3203 F(Augusta) + 62.38$. Moreover, the chart shows a quite smooth progression of temperatures along a curvilinear closed path in a one year loop. Now on any particular day of the year, or any particular time of day, there is a difference in temperature between the two sites that is on average fairly stable. If you want to know what it is, calculate or look up that difference. For example, for @gung, here are those average annual temperature differences between the two sites in degrees F compiled on days 0-365 of 2010. If you want to measure agreement then Lin's concordance correlation coefficient would be one alternative, but not a very useful one (see below). This is similar to an intraclass correlation and measures how distant an agreement is from the identity line $y=x$. Agreement is not the right question to ask of a time series model, like an

 ARIMAProcess[1.8589*10^-17, {0.05033}, 2, {-1.58602, 0.747954}, 0.00377009].


See ARIMAProcess.

Here are average monthly temperatures from Oslo, Sweden and Melbourne, Australia in degrees centigrade with correlation and coefficient of determination. For the OP, coefficient of determination in Excel is =correl(cell:cell,cell:cell)^2.

     Melbourne  Oslo
Jan      21      -3
Feb      21      -3
Mar      19       2
Apr      17       5
May      14      12
Jun      11      16
Jul      10      18
Aug      11      16
Sep      13      12
Oct      15       7
Nov      17       2
Dec      19      -3


$r=-0.981726823$ and $r^2=0.963787555$. Note how high the negative correlation is between two points on Earth that could not be further apart.

OLS regression shows this

 Term       |Coefficient |95% CI            |SE     |t statistic |DF |p
Intercept  |37.77       |33.42 to 42.13    |1.955  | 19.32      |10 |<0.0001
Slope      |-1.98       |-2.25 to -1.71    |0.121  |-16.31      |10 |<0.0001

Oslo = 37.77 - 1.98 Melbourne


Let us compare those results with Lin's concordance:

$$r_c=\frac{2 \rho \sigma _x \sigma _y}{\sigma _x^2+\left(\mu _x-\mu _y\right){}^2+\sigma _y^2}\,,$$

which is $r_c=0.148498$ for the Augusta to Miami value, and $r_c=-0.38624$ for the Oslo to Melbourne concordance. So in the first case, the concordance is weak, and in the second case there is a slightly stronger disagreement. This doesn't go very far in explaining the differences in temperature.

• (-1) Surely however closely correlated the hourly temperatures may be in Athens & Oslo, they're not similar. Apr 7 '18 at 11:47
• I don't think this merits 3 downvotes, although I don't think it's right, either. It is a valiant effort. Carl, you suggest $r^2$; the OP thought about the difference b/t temps. Consider the example you illustrate: $r^2=.98$, which sounds pretty similar, but consider that when A=19, M=68, a 49 degree difference, & when A=71, M=84, a 13 degree difference. Given the OP seems to want temps to have a small constant difference, do those seem as similar as $r=.98$ intuitively implies? They wouldn't to me. Apr 8 '18 at 1:24
• For a fuller understanding of my concern about this, it may help to read my answer here: Does Spearman's $r=0.38$ indicate agreement? Apr 8 '18 at 1:25
• I didn't downvote but sorry, I won't upvote this either. I am still unclear what the OP wants and won't answer an unclear question. . Trying to guess what the question is and then answering it is fine, but does not justify remarks like "peanut gallery" or "vindictive" directed at people who take a different view. Downvoting answers you think is wrong is allowed. If I was obliged to guess what the OP wants, I think it's not much more than a mean or median difference in temperature. I don't think $R^2$ or correlation or concordance correlation is likely to help at all, but that is just a guess. Apr 8 '18 at 8:19
• Much better now IMO. Lin's concordance is perhaps the type of similarity index the OP's looking for, but I think you show how the reduction of two data series to a single number isn't very informative about the nature of the differences between them. Apr 8 '18 at 11:09