[R] How to measure the significant difference between two time series

Gerard M. Keogh GMKeogh at justice.ie
Wed Nov 26 11:59:11 CET 2008

Q1: Quick answer

a) you need to remove the seasonality - there s/b a tool in the time series
package to do this - though I'm not familar enough with R to know this.
b) check the resulting series  to see if it is stationary  - acf decays
quickly i.e. within a couple of lags.
c) if two series are stationary then overlay the acf plots and if second
plot lies within the CI of the first they are the same.
d) on the seasonal parts of the two series do regression on year vs b1*q1+
b2*q2 + b3*q3 + b4*q4 and if the coefficients of the second are within the
2 Se band of the first - seasonality is similar.

if c) and d) are not signif - the two series are similar.

Also, standardise all your series so that they have mean 0 (or 1) and
variance 1 before you start - it'll make the numerics and comparisons
Also, before starting you may need to take logs if the series oscillations
increase with time.

Q2 - don't know what you mean by interannual variation - within year

Hope this helps.


             "Bin Zhao"                                                    
             <zhaobin1969 at gmai                                             
             l.com>                                                     To 
             Sent by:                  "r-help" <r-help at r-project.org>     
             r-help-bounces at r-                                          cc 
                                       [R] How to measure the significant  
             24/11/2008 04:13          difference between two time         
             Please respond to                                             
             zhaobin1969 at gmail                                             

Dear R experts and statisticians,

I have some time series datasets, they are several years vegetation indices
(about 50 data points per year) sampled from different station. These
indices have similar dynamics with seasonal change.

My questions are,
1) How can I compare the difference among the indices, and how can I say
there is significant differnce between two time series. They don't have the
same values in the same date, but they may have the similar tendency and
change curves?

2) I also want to compare the interannual variation of the vegetation index
in the same station. Of course, the index can be separated into several
sub-series, i.e., one year one sub-series. Now I have the same question as
1), how can I compare the significant differnce between different year?

If there are mature theoretical framework can resolve my questions, is
there any package in R can do this?

Any further advice is highly appreciated.


Bin Zhao

2008-11-24 , 10:53:58

             [[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.  It is the policy of the Department of Justice, Equality and Law Reform and the Agencies and Offices using its IT services to disallow the sending of offensive material.
Should you consider that the material contained in this message is offensive you should contact the sender immediately and also mailminder[at]justice.ie.

Is le haghaidh an duine nó an eintitis ar a bhfuil sí dírithe, agus le haghaidh an duine nó an eintitis sin amháin, a bheartaítear an fhaisnéis a tarchuireadh agus féadfaidh sé go bhfuil ábhar faoi rún agus/nó faoi phribhléid inti. Toirmisctear aon athbhreithniú, atarchur nó leathadh a dhéanamh ar an bhfaisnéis seo, aon úsáid eile a bhaint aisti nó aon ghníomh a dhéanamh ar a hiontaoibh, ag daoine nó ag eintitis seachas an faighteoir beartaithe. Má fuair tú é seo trí dhearmad, téigh i dteagmháil leis an seoltóir, le do thoil, agus scrios an t-ábhar as aon ríomhaire. Is é beartas na Roinne Dlí agus Cirt, Comhionannais agus Athchóirithe Dlí, agus na nOifígí agus na nGníomhaireachtaí a úsáideann seirbhísí TF na Roinne, seoladh ábhair cholúil a dhícheadú.
Más rud é go measann tú gur ábhar colúil atá san ábhar atá sa teachtaireacht seo is ceart duit dul i dteagmháil leis an seoltóir láithreach agus le mailminder[ag]justice.ie chomh maith. 

More information about the R-help mailing list