【问题标题】:Compare multiple time series比较多个时间序列
【发布时间】:2022-11-29 15:19:06
【问题描述】:

我有多个时间序列数据。

c1= c(0.558642328, 
0.567173803, 
0.572518969, 
0.579917556, 
0.592155421, 
0.600239837, 
0.598955071, 
0.608857572, 
0.615442061, 
0.613502347, 
0.618076897, 
0.626769781, 
0.633930194, 
0.645518577, 
0.66773088, 
0.68128165, 
0.695552504, 
0.6992836, 
0.702771866, 
0.700840271, 
0.684032428, 
0.665082645, 
0.646948862, 
0.621813893, 
0.597888613, 
0.577744126, 
0.555984044, 
0.533597678, 
0.523645413, 
0.522041142, 
0.525437844, 
0.53053292, 
0.543152606, 
0.549038792, 
0.555300856, 
0.563411331, 
0.572663951, 
0.584438777, 
0.589476192, 
0.604197562, 
0.61670388, 
0.624161184, 
0.624345171, 
0.629342985, 
0.630379665, 
0.620067096, 
0.597480375, 
0.576228619, 
0.561285031, 
0.543921304, 
0.530826211, 
0.519563568, 
0.514228535, 
0.515202665, 
0.516663855, 
0.525673366, 
0.543545395, 
0.551681638, 
0.558951402, 
0.566816133, 
0.573842585, 
0.578611696, 
0.589180577, 
0.603297615, 
0.624550509, 
0.641310155, 
0.655093217, 
0.668385196, 
0.671600127, 
0.658876967, 
0.641041982, 
0.605081463, 
0.585503519, 
0.556173635, 
0.527428073, 
0.502755737, 
0.482510734, 
0.453295642, 
0.439938772, 
0.428757811, 
0.422361642, 
0.40945864, 
0.399504355, 
0.412688798, 
0.42684828, 
0.456935656, 
0.48355422, 
0.513727218, 
0.541630101, 
0.559122121, 
0.561763656, 
0.572532833, 
0.576761365, 
0.576146233, 
0.580199403, 
0.584954906)


c2 = c(0.548312998, 
0.557590675, 
0.569792616, 
0.57648288, 
0.582519495, 
0.584094632, 
0.583095658, 
0.58734405, 
0.590847301, 
0.588833773, 
0.591280174, 
0.60634923, 
0.614732516, 
0.628865051, 
0.64757216, 
0.666375887, 
0.677957845, 
0.681262505, 
0.684586871, 
0.682824385, 
0.667175573, 
0.648371458, 
0.633537549, 
0.608043456, 
0.581588411, 
0.559924698, 
0.540028617, 
0.517327446, 
0.507012364, 
0.501844284, 
0.503439355, 
0.509529454, 
0.521872091, 
0.526565039, 
0.534752142, 
0.54074347, 
0.548374414, 
0.563411844, 
0.568870294, 
0.58314842, 
0.59602412, 
0.611573255, 
0.617278945, 
0.622240722, 
0.619769347, 
0.610022175, 
0.593835229, 
0.568100679, 
0.551525283, 
0.529572153, 
0.51428445, 
0.499277723, 
0.494636112, 
0.497823489,
0.498831296,
0.504156655,
0.518578172,
0.526088589,
0.537710232,
0.542733413,
0.555014384,
0.561118293,
0.56687597,
0.581570888,
0.604392135,
0.618327677,
0.635660493,
0.651578796,
0.644108343,
0.628193212,
0.608698857,
0.577001792,
0.559129715,
0.535084575,
0.511081594,
0.490507799,
0.470004833,
0.438273591,
0.425731319,
0.414378071,
0.411413676,
0.400676805,
0.396925634,
0.399999064,
0.412862909,
0.431658995,
0.458585095,
0.488017178,
0.509648013,
0.529197955,
0.535413015,
0.543576932,
0.544105291,
0.547104096,
0.54662621,
0.543324244)


c3 = c(0.232481461,
0.234331533,
0.236983097,
0.239418665,
0.251142623,
0.258787839,
0.27416779,
0.288656804,
0.311543879,
0.318174845,
0.322510272,
0.322567761,
0.327798945,
0.328320512,
0.334473217,
0.348781505,
0.361979774,
0.370497525,
0.371140084,
0.364378414,
0.351432962,
0.334426059,
0.311300224,
0.28731017,
0.253390689,
0.225132306,
0.199986064,
0.174223486,
0.164470221,
0.161742944,
0.165116308,
0.171975482,
0.192469646,
0.199604255,
0.217081873,
0.227614346,
0.234985653,
0.249016567,
0.258492273,
0.270134681,
0.284708416,
0.300111979,
0.301602611,
0.299326849,
0.301946108,
0.28775356,
0.265379742,
0.233876735,
0.214674118,
0.186715491,
0.166108309,
0.147216564,
0.145897944,
0.147968549,
0.146944046,
0.162383635,
0.184625961,
0.200818598,
0.215416914,
0.226366764,
0.233739947,
0.237156208,
0.241002475,
0.250965495,
0.268156333,
0.278750855,
0.301519382,
0.319674549,
0.307104857,
0.28811741,
0.264678046,
0.223922733,
0.199140929,
0.177024715,
0.152031524,
0.127592109,
0.111354212,
0.079259231,
0.067813135,
0.06893201,
0.072917068,
0.075522878,
0.070564032,
0.05824402,
0.049086138,
0.050384771,
0.050128536,
0.061492301,
0.086675285,
0.10030736,
0.107977158,
0.119556361,
0.120863232,
0.116997129,
0.119532892,
0.117785394) 

数据的日期顺序是:

dates = seq(as.Date("2016-09-01"), as.Date("2020-07-30"), by=15) #96 times observation  

我的问题是可以应用哪些统计方法来评估时间序列之间的相似性或差异性?我们能否评估时间序列的趋势是否在统计上彼此不同,以及在什么水平上?这个问题可以很宽泛和笼统。感谢有关统计测试的建议,以及可能用于评估这些问题的代码行。

另外,数据具有很强的季节性成分。

我发现了一些讨论 https://stats.stackexchange.com/questions/19103/how-to-statistically-compare-two-time-series, https://stats.stackexchange.com/questions/372086/statistically-evaluate-difference-between-time-series?noredirect=1&lq=1 但无法对我想做的事情推断出有意义的想法。

谢谢!

【问题讨论】:

    标签: r statistics time-series


    【解决方案1】:

    Chow检验用于检验两个时间序列数据是否来自同一个回归。

    Chow 检验用于检验两个不同回归模型在不同数据集上的系数是否相等。

    该测试通常用于计量经济学领域的时间序列数据,以确定数据在某个点是否存在结构性断裂。

    显然,从情节来看,时间序列似乎非常相似,系列 3 低于其他两个。有视觉证据表明所有三个系列的滞后 1 差异可能相同。

    执行测试的方法是将滞后 1 差值放在单个向量中并指定分离点。这是通过比较 c1 与 c2、c2 与 c3 以及 c1 与 c3 来完成的。

    c1= c(0.558642328, 
          0.567173803, 
          0.572518969, 
          0.579917556, 
          0.592155421, 
          0.600239837, 
          0.598955071, 
          0.608857572, 
          0.615442061, 
          0.613502347, 
          0.618076897, 
          0.626769781, 
          0.633930194, 
          0.645518577, 
          0.66773088, 
          0.68128165, 
          0.695552504, 
          0.6992836, 
          0.702771866, 
          0.700840271, 
          0.684032428, 
          0.665082645, 
          0.646948862, 
          0.621813893, 
          0.597888613, 
          0.577744126, 
          0.555984044, 
          0.533597678, 
          0.523645413, 
          0.522041142, 
          0.525437844, 
          0.53053292, 
          0.543152606, 
          0.549038792, 
          0.555300856, 
          0.563411331, 
          0.572663951, 
          0.584438777, 
          0.589476192, 
          0.604197562, 
          0.61670388, 
          0.624161184, 
          0.624345171, 
          0.629342985, 
          0.630379665, 
          0.620067096, 
          0.597480375, 
          0.576228619, 
          0.561285031, 
          0.543921304, 
          0.530826211, 
          0.519563568, 
          0.514228535, 
          0.515202665, 
          0.516663855, 
          0.525673366, 
          0.543545395, 
          0.551681638, 
          0.558951402, 
          0.566816133, 
          0.573842585, 
          0.578611696, 
          0.589180577, 
          0.603297615, 
          0.624550509, 
          0.641310155, 
          0.655093217, 
          0.668385196, 
          0.671600127, 
          0.658876967, 
          0.641041982, 
          0.605081463, 
          0.585503519, 
          0.556173635, 
          0.527428073, 
          0.502755737, 
          0.482510734, 
          0.453295642, 
          0.439938772, 
          0.428757811, 
          0.422361642, 
          0.40945864, 
          0.399504355, 
          0.412688798, 
          0.42684828, 
          0.456935656, 
          0.48355422, 
          0.513727218, 
          0.541630101, 
          0.559122121, 
          0.561763656, 
          0.572532833, 
          0.576761365, 
          0.576146233, 
          0.580199403, 
          0.584954906)
    
    
    c2 = c(0.548312998, 
           0.557590675, 
           0.569792616, 
           0.57648288, 
           0.582519495, 
           0.584094632, 
           0.583095658, 
           0.58734405, 
           0.590847301, 
           0.588833773, 
           0.591280174, 
           0.60634923, 
           0.614732516, 
           0.628865051, 
           0.64757216, 
           0.666375887, 
           0.677957845, 
           0.681262505, 
           0.684586871, 
           0.682824385, 
           0.667175573, 
           0.648371458, 
           0.633537549, 
           0.608043456, 
           0.581588411, 
           0.559924698, 
           0.540028617, 
           0.517327446, 
           0.507012364, 
           0.501844284, 
           0.503439355, 
           0.509529454, 
           0.521872091, 
           0.526565039, 
           0.534752142, 
           0.54074347, 
           0.548374414, 
           0.563411844, 
           0.568870294, 
           0.58314842, 
           0.59602412, 
           0.611573255, 
           0.617278945, 
           0.622240722, 
           0.619769347, 
           0.610022175, 
           0.593835229, 
           0.568100679, 
           0.551525283, 
           0.529572153, 
           0.51428445, 
           0.499277723, 
           0.494636112, 
           0.497823489,
           0.498831296,
           0.504156655,
           0.518578172,
           0.526088589,
           0.537710232,
           0.542733413,
           0.555014384,
           0.561118293,
           0.56687597,
           0.581570888,
           0.604392135,
           0.618327677,
           0.635660493,
           0.651578796,
           0.644108343,
           0.628193212,
           0.608698857,
           0.577001792,
           0.559129715,
           0.535084575,
           0.511081594,
           0.490507799,
           0.470004833,
           0.438273591,
           0.425731319,
           0.414378071,
           0.411413676,
           0.400676805,
           0.396925634,
           0.399999064,
           0.412862909,
           0.431658995,
           0.458585095,
           0.488017178,
           0.509648013,
           0.529197955,
           0.535413015,
           0.543576932,
           0.544105291,
           0.547104096,
           0.54662621,
           0.543324244)
    
    
    c3 = c(0.232481461,
           0.234331533,
           0.236983097,
           0.239418665,
           0.251142623,
           0.258787839,
           0.27416779,
           0.288656804,
           0.311543879,
           0.318174845,
           0.322510272,
           0.322567761,
           0.327798945,
           0.328320512,
           0.334473217,
           0.348781505,
           0.361979774,
           0.370497525,
           0.371140084,
           0.364378414,
           0.351432962,
           0.334426059,
           0.311300224,
           0.28731017,
           0.253390689,
           0.225132306,
           0.199986064,
           0.174223486,
           0.164470221,
           0.161742944,
           0.165116308,
           0.171975482,
           0.192469646,
           0.199604255,
           0.217081873,
           0.227614346,
           0.234985653,
           0.249016567,
           0.258492273,
           0.270134681,
           0.284708416,
           0.300111979,
           0.301602611,
           0.299326849,
           0.301946108,
           0.28775356,
           0.265379742,
           0.233876735,
           0.214674118,
           0.186715491,
           0.166108309,
           0.147216564,
           0.145897944,
           0.147968549,
           0.146944046,
           0.162383635,
           0.184625961,
           0.200818598,
           0.215416914,
           0.226366764,
           0.233739947,
           0.237156208,
           0.241002475,
           0.250965495,
           0.268156333,
           0.278750855,
           0.301519382,
           0.319674549,
           0.307104857,
           0.28811741,
           0.264678046,
           0.223922733,
           0.199140929,
           0.177024715,
           0.152031524,
           0.127592109,
           0.111354212,
           0.079259231,
           0.067813135,
           0.06893201,
           0.072917068,
           0.075522878,
           0.070564032,
           0.05824402,
           0.049086138,
           0.050384771,
           0.050128536,
           0.061492301,
           0.086675285,
           0.10030736,
           0.107977158,
           0.119556361,
           0.120863232,
           0.116997129,
           0.119532892,
           0.117785394) 
    
    plot(ylim=range(c(c1,c2,c3)), c1, type="l", xlab="Time", ylab="")
    lines(c2, type="l", col="red")
    lines(c3, type="l", col="blue")
    
    #install.packages("strucchange")
    library(strucchange)
    
    
    dat = data.frame(x = 1:190, c12 = c(diff(c1), diff(c2)), 
                     c13=c(diff(c1),diff(c3)),
                     c23=c(diff(c2),diff(c3)))
    
    sctest(dat$c12 ~ dat$x, type="Chow", point=95)
    sctest(dat$c13 ~ dat$x, type="Chow", point=95)
    sctest(dat$c23 ~ dat$x, type="Chow", point=95)
    

    根据结果​​,这三个都可能来自同一个回归。尽管如此,与 c3 相比,c1 看起来与 c2 更相似。

    输出

    > sctest(dat$c12 ~ dat$x, type="Chow", point=95)
    
        Chow test
    
    data:  dat$c12 ~ dat$x
    F = 0.010695, p-value = 0.9894
    
    > sctest(dat$c13 ~ dat$x, type="Chow", point=95)
    
        Chow test
    
    data:  dat$c13 ~ dat$x
    F = 0.25134, p-value = 0.778
    
    > sctest(dat$c23 ~ dat$x, type="Chow", point=95)
    
        Chow test
    
    data:  dat$c23 ~ dat$x
    F = 0.2534, p-value = 0.7764
    

    【讨论】:

      猜你喜欢
      • 2020-06-09
      • 1970-01-01
      • 1970-01-01
      • 2020-07-16
      • 2014-10-08
      • 2010-12-30
      • 2015-06-12
      • 1970-01-01
      • 2012-12-01
      相关资源
      最近更新 更多