12周的网页浏览频次数据(日数据),通过绘制时序图、自相关图和偏自相关图,发现序列具有明显的增长趋势、初步判断具有周期性。想找出其最佳的周期性,如1周、2周?应该怎么做?我尝试对序列进行差分,分别设置1阶7天、1阶14天的差分,三种情况下序列都是平稳序列。然后对三个序列进行单位根检验。得到的结果是:
>x.dif.7.df<-ur.df(x.dif.7,type="trend") # 1周差分
> summary(x.dif.7.df)
###############################################
# Augmented Dickey-Fuller Test Unit Root Test#
###############################################
Test regression trend
Call:
lm(formula = z.diff ~ z.lag.1 + 1 + tt +z.diff.lag)
Residuals:
Min 1Q Median 3Q Max
-63.145 -25.093 3.846 19.547 73.402
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.11929 12.63444 -0.009 0.9925
z.lag.1 -1.84653 0.30271 -6.100 1.21e-06 ***
tt 0.05168 0.62259 0.083 0.9344
z.diff.lag 0.34316 0.19466 1.763 0.0885 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’1
Residual standard error: 33.8 on 29 degreesof freedom
Multiple R-squared: 0.7089, AdjustedR-squared: 0.6788
F-statistic: 23.55 on 3 and 29 DF, p-value: 6.351e-08
Value of test-statistic is: -6.1 12.4219 18.6318
Critical values for test statistics:
1pct 5pct 10pct
tau3 -4.15 -3.50 -3.18
phi2 7.02 5.13 4.31
phi3 9.31 6.73 5.61
>x.dif.14.df<-ur.df(x.dif.14,type="trend") # 2周差分
> summary(x.dif.14.df)
###############################################
# Augmented Dickey-Fuller Test Unit Root Test#
###############################################
Test regression trend
Call:
lm(formula = z.diff ~ z.lag.1 + 1 + tt +z.diff.lag)
Residuals:
Min 1Q Median 3Q Max
-58.40 -15.75 -3.06 22.26 53.77
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.1634 13.0158 0.320 0.752
z.lag.1 -2.0955 0.3808 -5.503 1.57e-05 ***
tt -0.1284 0.8020 -0.160 0.874
z.diff.lag 0.3750 0.2378 1.577 0.129
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’1
Residual standard error: 30.36 on 22 degreesof freedom
Multiple R-squared: 0.7496, AdjustedR-squared: 0.7154
F-statistic: 21.95 on 3 and 22 DF, p-value: 8.251e-07
Value of test-statistic is: -5.5026 10.2205 15.3083
Critical values for test statistics:
1pct 5pct 10pct
tau3 -4.15 -3.50 -3.18
phi2 7.02 5.13 4.31
phi3 9.31 6.73 5.61
是否可以根据上述红色行判断,序列差分1周(-6.1)比2周(-5.5026)的周期性更加明显?
请大神指导!!谢谢!