王燕时间序列分析第五章SAS程序.docx
《王燕时间序列分析第五章SAS程序.docx》由会员分享,可在线阅读,更多相关《王燕时间序列分析第五章SAS程序.docx(25页珍藏版)》请在冰豆网上搜索。
![王燕时间序列分析第五章SAS程序.docx](https://file1.bdocx.com/fileroot1/2023-2/3/9892e41c-3247-4345-ba09-bde36abee206/9892e41c-3247-4345-ba09-bde36abee2061.gif)
王燕时间序列分析第五章SAS程序
第一题
datayx_51;
inputx@@;
difx=dif(x);
t=l+_n_-l;
cards;
304303307299296293301293301295284286286287284282278281
278277279278270268272273279279280275271277278279283
284282283279280280279278283278270275273273272275273
273277274274272280282292295295294290291288288290293288
289Z91293293290288287Z89292288288285282286286287284
283286282287286287292292294291288289
9
procgplot;
plotx*t=ldifx*t=2;
symbo1lc=redv=circlei=join;
symbo12c=ye11owv=stari=join;
run;
procarima;
identifyvar=x
(1);
estimatep=l;
run;
结果如下时序图:
-阶差分后时序图:
difi
10
-10
・20
1020
3040506070
60
90100110
SAS系统
2014年05月06日星期二下午10时47分58秒1
TheARIMAProcedure
NameofVariable=x
Period(s)ofDifferencing
MeanofforkingSeries
StandardDeviation
NumberofObservations
Observation(s)eliminatedbydifferenci
1
-0.14151
3.614537
106
1
Autocorrelations
StdError
0
1
13.064881
-2.020214
1.00000-.15483
2
0.251847
0.01928
3
-0.803468
-.06315
4
-1.166473
-.08928
5
-0.407940
-.03122
•*
6
1.366363
0.10463
榊:
7
2.461031
0.18837
8
-0.727748
-.05570
:
務
9
0.622454
0.04764
«:
10
-1.716200
-.13136
•出林
11
0.824106
0.06308
*:
12
0.136572
0.01045
13
0.636280
0.04097
♦.
14
-1.830163
-.14008
15
2.002506
0.15327
曲
16
-1.865607
-.14280
17
-0.535607
■•04100
・*
18
0.849572
0.06503
*
19
0.473360
0.03623
♦
20
0.560746
0.04292
*,
21
-2.602490
••19920
22
-0.104103
-.00797
23
-0.666324
-.05100
•*
24
-0.537108
-.04111
・«
LagCovariance
Correlation
•198765432101234567891
markstwostand&rderrors
0.0371290.0994240.0394580.0999120.1006620.1007530.1017730.1050100.1052890.1054920.1070240.1073740.1073840.1075310.1092390.1112490.1129650.1131060.1134580.1135670.1137200.1169650.1169700.117180
2ai4^05H06tl星期二I、午10旳47甘58抄2
InverseAutocorrelations
1
2
0.12567-0.05929
3
0.02402
4
0.17471
*>K«.
5
0.03817
来■
6
・0.17242
•;•冷肾;
?
-0.219D6
8
0.08852
佛岀•
9
-0.01671
10
-0.00157
11
-0.09685
■榊
12
0.01518
13
0.09241
删.
14
0.06628
*•
15
-0.18306
H4nh*
16
0.07964
1?
0.08334
18
0.01169
LftgCorrelfttion
SAS糸统
TheARINAProcedure
19
-0.05799
•#
■
20
0.01034
■
21
0.1762&
22
0.08267
桝.
23
・0.01342
•
24
0.06638
*.
Correlation
2
-198
34567891
PartialAutocorrelations
1
-0.15463
2
-0.00475
3
-0.06853
•*
4
-0.11359
5
-0.06560
•*
6
0.08742
7
0.21551
8
-0.00482
9
0.04333
«•
10
・0.07757
•
11
0.07S3&
12
0.04034
13
-0.00237
14
-0.19934
15
0.12464
榊:
16
-0.03053
:
**
17
-0.06859
.*
18
-0.01418
19
0.06543
«・
20
0.06544
«・
21
-0.18418
22
-0.12096
23
0.04340
24
-0.08493
LagCorrelation
AutocorrelationCheckforWhiteNoise
To
Lac
6
12
IS
24
Ch卜
Square
5.44
12.72
21.69
28.05
DF
6
12
18
24
Pr>
ChiSq
0.4830
0.3896
0.2462
0.2579
A1|_■•
-0.1550.019
0.188-0.056
0.041-0.140
0.0360.043
Hutuuurrciatimi3
-0.031
0.063
-0.041
-0.051
0.105
0.010
0.065-0.041
-0.069
0.048
0.153-0.199
-0.088
-0.131
-0.143
-0.008
ConditionalLeastSquares
Estimation
Standard
Approx
Paratneter
Estimate
Errort
:
Value
Pr>Itl
Lag
MU
-0.14201
0.30359
-0.47
0.6409
0
AR1,1
-0.15478
0.09692
-1.60
0.1133
1
TheARIMAProcedure
-0.16393
12.98744
3.605196
574.6596
579.9865
106
logdeterminant・
ConstantEstimate
VarianeeEstiinate
SidErrorEstimate
AIC
SBC
NumberofResidualsAICandSBCdonotinclude
CorreIationsofPa.rameter
Estimates
ToLag
Chi-
Square
DF
Pr>ChiSq
Auxocorre1ations
e
4.31
5
0.5056
-0.001
・0.015
・0.083
・0.110
-0.030
0.134
12
11.35
11
0.4148
0.205
-0.021
0.020
-0.120
0.Q47
0.028
18
18.00
17
0.3889
0.023
-0.116
0.116
-0.132
-0.055
0.068
24
25.30
23
0.3352
0.055
0.020
-0.204
-0.048
-0.061
•0.054
AutocorrelationCheckof
Residuals
-0.14201
1
EstimatedMean
Period(s)ofDifferenci
AutoregressiveFactors
Factor1:
1+0.15478B^
(1)
通过原始数据的时圧图可以明显看出,此圧列非平稳,因而对丿子列进行一阶差分。
从一阶差分后的自相关图可以看出,一阶差分后的序列的门相关系数一直都比较小,始终控制在二倍标准差以内,可以认为一阶差分后的序列始终都在零轴附近波动,冈而可以认为一阶差分后的序列为随机性很强的平稳仔列,另外通过一阶差分后的时序图也可以看出,一阶差分后的序列半稳,且LB统计最对应的P值大于a=0.05,因而认为一阶差分后的序列为白噪声序列。
由于一阶差分后的字列为平稳的白噪声斥列,因而此时间序列拟合ARIMA(0.1,0)模型,即随机游走模型,模型为:
&訓1+&
所以下一期的预测值为289
第二题
datayx_52;inputx@@;t=1949+_n_-l;difx=dif(x);cards;
5589.00
19376.
9983・00
0024605.
11083.00
00
13217.00
16131.00
19288.00
27421・00
38109.00
54410.00
67219.00
44988.00
35261.00
36418.
0041786.
00
49100.00
54951・00
43089.00
42095.00
53120・00
68132・00
76471.
0080873.
00
83111.00
78772.00
88955.00
84066.00
95309.00
110119.00
111893・00111279・00
107673.00
113495.00
118784.00
124074.00
130709・00
135635.00
140653.
00144948.
00
151489.00
150681・00
152893・00
157627.00
162794.00
163216.00
165982.
00171024.
00
172149.00
164309.00
1675S4.00
178581.00
193189・00
204956.00
224248.
00249017.
00
269296・00
288224.00
314237.00
330354.00
procgplot;
plotx*t=ldifx*t=2;
symbollc=orangev=circlei=none;symbol2c=bluev=stari=join;procarima;
iderrtifyvaf=x
(1);
estimateq=l;
forecastiead=5id=t;
时序图:
400000
300000
200000
100000
iao1W01%0197019®c199020002010
t
从时序图可以看出,时间序列非平稳,且随着时间而呈现明显的上升趋势,因而对序列采用一阶差分:
一阶差分后的时序图:
2014年05月07曰星期三下午11时03分5?
秒
SAS系统
TheARIMAProcedure
NameofVariable=x
Period(s)ofDiffer©ncing;1
MeanofWork!
ngSeries5504.492
StandardDeviation8441.125
NumberofObservations59
Observation(s)eIiminatedbydifferencing1
Autocorrelations
0
71252593
1.00000
0
1
36040915
0.50582
•
欢脚脚脚出紂
0.190189
2
11714363
0.16441
■
0.160069
3
5260217
0.07382
*•
0.162906
4
8000927
0.11229
««•
0.163472
5
9746449
0.13679
溶榊•
0.164774
6
12334598
0.17311
*SW.
0.166688
7
3819318
0.05360
*•
0.169708
8
-10165750
-.14267
•氷榊
0.168894
9
-11251547
-.15791
0.172012
10
-6251580
-.08774
•
0.174452
11
-1171287
-.01644
0.175198
12
3850896
0.05405
0.175224
13
1786424
0.0250?
«•
0.175506
14
-1315326
-.01846
0.175567
LagCovariance
Correlation
-198765432101234567891
StdError
markstwostandarderrors
Inverse占utocorrelations
-0.45223
0.0舲65
芈寧屮*宋出屮昭卑
0.04221
-0.13557
•柑*
0.07544
-0.08184
・0.07917
0.15808
***
-0.02016
10
0.00599
11
0.05993
12
-0.08m
19
0.04124
出
14
-0.02919
PartiaI右utocorreIations
1
2
0.50582-0.12289
■
3
0.05813
•
出•
4
0.09044
•
5
0.05040
•
出.
6
0.10396
•
7
-0.11363
8
-0.18030
SAS务统2014^05月07日星期三下午11时03分57秒2
TheARIMAProcedure
PartialAutocorrelations
9-0.00473
10-0.02212
110.02688
120.08735
13-0.01434
140.03958
15
AutocorrelationCheckforWhiteNoise
Parameter
Estincite
Standard
Error
tValue
Approx
Pr>Itl
Lag
MU
5536.6
1430.1
3.87
0.0003
0
MA1,1
-0.48349
0.11623
-4.16
0.0001
1
ConditionaI
LeastSquaresEstimation
*AICandSBCdonotincIudelogdeterninant.
ConstantEstimate5536・65VarianceEstimate55720793StdErrorEstimate7464.636AIC1221.716S8C1225.871NumberofResiduals59
CorrelationsofParaneter
Estimfttes
Parameter
MU
MALI
MU
1.000
0.003
MAIJ
0.003
1.000
Residuals
AutocorrelationCheckof
To
Lac
Chi-Square
DF
Pr>
ChiSq
ocorreiatiode
6
4.69
5
0.4552
0.094
0.156
-0.022
0.115
0.050
0.151
12
7.25
11
0.7785
0.053
0.132
-0.097
-0.046
-0.026
0.058
18
9.33
I7
0.9294
0.023
-0.049
0.048
-0.112
-0.044
0.070
24
10.67
23
0.9863
0.088
-0.030
-0.071
0.013
-0.023
-0.00?
5536.65
EstImatedMean.
Period(s)ofDifferencing
SAS系裁2014^05月07曰星期三下午II时03分57秒6
TheARINAProcedure
MovingAverageFactors
Factor1:
140.48349
Forecastsforvariablex
Obs
Forecast
StdError
95XConfidenceLimits
61
337276.9837
7464.6361
322646.5657
351907.4017
62
342813.6336
13354.667
316638.9669
368988.3004
63
348350・2836
17348.58?
314347.6774
382352.8888
64
353886.9336
20581.541
313547.8548
394226.0123
85
359423.5835
23371.482
313G1G.32O8
405230.8463
通过原始数据的时用图可以明显看出,此序列非平稳,随着时间呈现上升趋势,因而对序列进行一阶差分。
从一阶差分后的H相关图可以看出,一阶差分后的序列的自相关系数一阶截尾,拟合ARIMA(0,1,1)模型,得到模型:
XrXt.i=(H-0.48349B)et
残差的检验显示,残差序列通过白噪声检验,参数显苦性检验显示参数显著:
,说明模型拟合良好,对序列相关信息提取充分。
得到2009~2013年铁路货运最的预测结果如下:
铁路货运与测量
2009
337276.9837
2010
342813.6336
2011
348350.2836
2012
3538X69336
2013
359423.5835
第三题;
datayx_53;
inputx@@;
difx=dif(dif12(x));
t=intnx(fmonth19f01janl973fdr_n_-l);formattdate・;
cards;
9007.008106.008528.00
11317.0010744.00
9713.00
9938・00
9161・00
8038.00
8422.00
8714.
10120.00
9823.00
8743.00
8162.00
7306.00
8124.
7870.00
9387.00
9SS6・00
8433.00
8160.00
8034.
7717.007461.007776・00
10078・009179・00
8037.
8488.007874.00
8647.00
8106.008890.00
9299.
9302.008314.00
8850.00
6892.007791・00
8129.
9434.0010484.00
9827.00
9240.00
9137.00
10017.00
10826.00
8927・00
7750.00
6981.00
00
9512.DO
9129.00
8710.00
8680.00
00
10093.00
9620.00
8285.00
00
7925.00
8634.00
8945.00
00
7792.00