《如每月物价每年产值等影响时间序列变化有四个成因》由会员分享,可在线阅读,更多相关《如每月物价每年产值等影响时间序列变化有四个成因(64页珍藏版)》请在金锄头文库上搜索。
1、如每月物价每年产值等影响时间序列变化有四个成因Stillwatersrundeep.流静水深流静水深,人静心深人静心深Wherethereislife,thereishope。有生命必有希望。有生命必有希望ARMAmodel又稱為Box-Jankinmodel,1970年代推出用來配適時間序列中的不規則震盪適用於Stationaryseries,可解釋序列中的自相關現象。Stationaryseries(平穩序列)定義:一時間序列的統計特性與時間t無關,皆是固定值,稱為平穩序列E(Yt)=,var(Yt)=2,cor(Yt,Yt+k)=kfor all tARMA模式模式僅與時差k有關Quan
2、_ARMA2StationaryseriesNonstationaryseries6.1平穩序列StationaryseriesQuan_ARMA3ty1stDiff115214.4064-0.5936314.93830.5319416.03741.0991515.632-0.4054614.3975-1.2345713.8959-0.5016814.07650.1806916.3752.29851016.53420.1592FirstDifferencesZt=YtYt-1此為一nonstationary序列如果手中的時序資料不是stationary,必須將它轉為stationary如何轉換
3、?利用差分轉換Quan_ARMA4例6.1一hotel每週住房人數資料,共120筆Quan_ARMA5例例6.1nonstationaryseriesFirstdifferenceSeconddifferenceQuan_ARMA61.圖形觀察:原資料圖、差方資料圖2.觀察自相關係數函數圖(ACF圖)3.檢定法:如何檢測stationarity(平穩性)?Dickey-FullertestPhillips-PerrontestRandom-walkwithdrifttestQuan_ARMA71.Backward運算:B(Yt)=Yt-1,B2(Yt)=Yt-22.Firstdifferenc
4、e一階差分:3.Seconddifferences二階差分:差分運算5.Differencewithlagk:Quan_ARMA8差分功能一階差分消去直線 trend二階差方消去二次 trend 消除季節因素四季節差分月季節差分Quan_ARMA96.2自相關係數函數自相關係數函數(ACF)autocorrelationatlagk:cor(Yt,Yt+k)=kk階自相關係數:ACF:autocorrelationfunction,由rk,k=0,1,2,.組成的函數Standarderrorofrk:Quan_ARMA10Ingeneral,1.IftheACFeithercutsofffa
5、irlyquicklyordiesdownfairlyquickly,thenthetimeseriesshoudbeconsideredstationary.2.IftheACFdiesdownextremelyslowly,thenthetimeseriesshouldbeconsiderednonstationary.3.檢定j=0,forallj以ACF判斷平穩性Quan_ARMA11LagCovarianceCorrelation-198765432101234567891StdError019.1622941.00000|*|0118.4456060.96260|.|*|0.091
6、287217.3885030.90743|.|*|0.154197316.3499290.85323|.|*|0.193651415.3436920.80072|.|*|0.222787514.2329020.74276|.|*|0.245601613.1163310.68449|.|*|0.263656712.0288510.62774|.|*|0.278071811.0888600.57868|.|*|0.289639910.1857090.53155|.|*.|0.299119109.4936860.49544|.|*.|0.306890118.9779980.46852|.|*.|0.
7、313484128.5173820.44449|.|*.|0.319266137.9709550.41597|.|*.|0.324382147.3477670.38345|.|*.|0.328797156.7604400.35280|.|*.|0.332503166.1885610.32296|.|*.|0.335608175.5664040.29049|.|*.|0.338187184.8032830.25066|.|*.|0.340260193.8827120.20262|.|*.|0.341796202.9611250.15453|.|*.|0.342795212.1446190.111
8、92|.|*.|0.343375221.3890100.07249|.|*.|0.343679.markstwostandarderrorsACFforExp6.1Quan_ARMA12AutocorrelationCheckforWhiteNoiseToLagChi-SquareDFPrChiSqAutocorrelations6518.576.00010.9630.9070.8530.8010.7430.68412739.5912.00010.6280.5790.5320.4950.4690.44418836.6218.00010.4160.3830.3530.3230.2900.2512
9、4848.8724ChiSqAutocorrelations614.9660.02060.307-0.065-0.0720.1050.0840.0231225.27120.0136-0.133-0.119-0.174-0.118-0.0520.0211834.95180.00960.0410.019-0.061-0.0020.1280.2152437.22240.04160.056-0.045-0.070-0.035-0.052-0.038TestH0:j=0,j=1,2,kQuan_ARMA15SamplepartialautocorrelationatlagkisPACF:partiala
10、utocorrelationfunction,由rkk,k=0,1,2,.組成的函數Standarderrorofrkk:ACF及PACF是辨識Box-Jenkins模式的重要工具Quan_ARMA166.3ARMAmodelARMAmodel由二部份組成:AR及MAAR:autoregression自迴歸,是依變數的自行迴歸,如MA:movingaverage移動平均,是誤差項的加權和,如二者都是將前段時間的資訊納入迴歸模式中,來對目前的觀察現象作解釋Lettbewhitenoiseprocess,Ztbeastationaryseries.whitenoise:純雜訊tNID(0,2)Qu
11、an_ARMA17AR(p),AutoregressivemodelwithorderpisdefinedasMA(p),MovingaveragemodelwithorderqisdefinedasARMA(p,q),Autoregressiveandmovingaveragewithorder(p,q)isdefinedas註:是一constant,並不一定是Quan_ARMA18註:1、AR(p)model可以下列式表示(assume=0):2、MA(q)model可以下列式表示:3、ARMA(p,q)model可以下列式表示:是B的p次多項式,是B的q次多項式,Quan_ARMA19M
12、A(q)modelZt之變異數及自相關係數:Movingaveragewithorderq:由此得到參數估計量註:ForMA(q)model,=Quan_ARMA20Zt偏自相關係數(partialautocorrelation):ForMAmodel,ACFcutsoffafterlagq,PACFdiesdown.Quan_ARMA21MA(1)model由此得到估計量theta0.90.70.50.30.1-0.1-0.3-0.5-0.7-0.9Rho_1-0.50 -0.47 -0.40 -0.28 -0.10 0.10 0.28 0.40 0.47 0.50 phi_11-0.50
13、-0.47 -0.40 -0.28 -0.10 0.10 0.28 0.40 0.47 0.50 phi_220.33 0.28 0.19 0.08 0.01 0.01 0.08 0.19 0.28 0.33 phi_33-0.24 -0.19 -0.09 -0.02 0.00 0.00 0.02 0.09 0.19 0.24 phi_440.19 0.13 0.05 0.01 0.00 0.00 0.01 0.05 0.13 0.19 Quan_ARMA22Quan_ARMA23MA(2)model由此得到參數估計量Quan_ARMA24Quan_ARMA25AR(p)modelAutore
14、gressivewithorderp此模式滿足平穩性的條件:係數使得方程式的根在單位圓外VarianceforAR(p)modelAutocorrelationforAR(p)modelQuan_ARMA26PartialAutocorrelationforAR(p)model稱為Yule-Walker等式,由此得到估計量ForARmodel,ACFdiesdown,PACFcutsoffafterlagp.Quan_ARMA27Stationarity之條件ACF呈指數下降,或波動下降;PACF在k=2處切斷註:AR(1)過程又稱為馬可夫過程(Markovprocess)例:Zt=6-0.8
15、Zt-1+tQuan_ARMA28Quan_ARMA29Stationarity之條件Yule-Walker等式:例:Zt=Zt-1-0.6Zt-2+tQuan_ARMA30Quan_ARMA31Quan_ARMA32ARMA(p,q)model若qp,前面q-p+1個p和其它的p呈二段式遞減Quan_ARMA33ACF與PACF皆漸漸消失型(dampedexponentiallyorsine-wave)Quan_ARMA34Quan_ARMA35ModelacfPacfMA(q)時差q之後切斷指數或正弦函數式漸漸消失AR(p)指數或正弦函數式漸漸消失時差p之後切斷ARMA(p,q)指數或正弦
16、函數式漸漸消失指數或正弦函數式漸漸消失ARMAmodel中acf與pacf的表象以上列出的 acf 與 pacf 的特性將作為辨識適合的 ARMA模式的準則。Quan_ARMA366.4ARMA建模的步驟建模的步驟1) 1)StationizeStationize: 檢測序列的平穩性,對不平穩的序列,差分轉換為平穩序列。2) 2)Tentative identificationTentative identification: 由資料的 acf, pacf 辨識適合的 ARMA模式, 選出數個可能模式。3) 3)EstimationEstimation: 對遴選模式估計參數4) 4)Diagn
17、ostic CheckingDiagnostic Checking: 由各種診斷法來檢視模式的適合性,挑選出一模式,視為用於預測的模式5) 5)ForecastingForecasting: 以最終模式預測未來值6)應隨時做模式的更新。Quan_ARMA37(1)平穩化過程平穩化過程如果手中的時序資料不是stationary,以一次差分轉換,使成為一stationaryseries,必要時用多次差分。利用檢定確認它是一平穩序列Quan_ARMA38(2)初步辨識初步辨識由樣本的acf及pacf的走勢及變化來辨識ARMA模式中的p,q值選出數個候選模式模式應力求簡單ModelacfPacfMA(
18、q)時差q之後切斷指數或正弦函數式漸漸消失AR(p)指數或正弦函數式漸漸消失時差p之後切斷ARMA(p,q)指數或正弦函數式漸漸消失指數或正弦函數式漸漸消失Quan_ARMA39(3)參數估計參數估計原則上用leastsquareestimate估計的係數必滿足平穩性及可逆性之條件ARMA係數的估計有時需以遞迴的數值法得解,有可能遇到不收歛情況Quan_ARMA40例例:一平穩序列,依據下列現象分別以AR(1),MA(1),及ARMA(1,1)配適:AutocorrelationsLagCorrelation65432101234567891-01.00000|*|01-.43773|*|.|
19、0.10000020.05214|.|*.|0.1176103-.00119|.|.|0.1178414-.07136|.*|.|0.1178415-.00389|.|.|0.1182736-.09027|.*|.|0.11827470.08643|.|*.|0.1189618-.04553|.*|.|0.11958790.08755|.|*.|0.11976010-.13564|.*|.|0.120399110.18628|.|*.|0.12191712-.24375|*|.|0.124731ACFPACFPartialAutocorrelationsLagCorrelation-19876
20、54321012345678911-0.43773|*|.|2-0.17253|.*|.|3-0.06368|.*|.|4-0.11413|.*|.|5-0.11104|.*|.|6-0.19625|*|.|7-0.07274|.*|.|8-0.08091|.*|.|90.02756|.|*.|10-0.14766|.*|.|110.07253|.|*.|12-0.20707|*|.Quan_ARMA41以AR(1)配適:ConditionalLeastSquaresEstimationParameterEstimateStandardErrortValueApproxPr|t|LagAR1,
21、1-0.443830.09084-4.89|t|LagMA1,10.646350.077788.31|t|LagMA1,11.000000.0156563.89.00011AR1,10.371170.095793.870.00021VarianceEstimate1.01438StdErrorEstimate1.007164AIC287.1952SBC292.4055NumberofResiduals100Quan_ARMA44(3)模式診斷模式診斷一個適合的模式需滿足:殘差為whitenoise、及係數顯著若殘差不為whitenoise,表示仍有自相關現象存在於殘差內,所選的階數不夠若係數不
22、顯著,表示自變數之間有相關性,參數個數太多,所選的階數超過Quan_ARMA45殘差為whitenoise之檢測:1、autocorrelationcheckforresidual(chi-squaretest)H0:1=2=k=0(在SAS中每六個檢定一次)p-value0.05,結論為其中至少有一個不為02、依據殘差的ACF,PACF,考慮要增加的項目係數的檢測:1、顯著性t-testp-value0.05的2、共線性狀況檢查係數的相關係數Quan_ARMA46AIC,SBC模式判定值AICk=nln(SSEk)nln(n)+2kSBCk=nln(SSEk)nln(n)+ln(n)k此處S
23、SE為誤差平方值,k為估計參數個數,判定值愈小,模式愈佳。預測式的選取當我們得到了數個適合的模式,比較AIC、SBC、標準誤、以及相關的適合現象,最後選一最理想的做為預測式。原則上,預測式愈簡單愈好。Quan_ARMA47例題:一、以AR(1)配適:AutocorrelationCheckofResidualsToLagChi-SquareDFPrChiSqAutocorrelations66.4350.2663-0.076-0.163-0.020-0.105-0.096-0.0881210.35110.49910.0600.0230.029-0.0620.062-0.1471817.8317
24、0.39970.093-0.0670.0640.077-0.1410.1352424.79230.36130.101-0.105-0.1640.075-0.0150.017另由殘差的ACFPACF顯示無自相關二、以MA(1)配適:AutocorrelationCheckofResidualsToLagChi-SquareDFPrChiSqAutocorrelations68.1550.14840.0670.061-0.051-0.151-0.141-0.1511213.10110.28700.003-0.0390.018-0.1070.043-0.1671819.11170.32250.093
25、-0.0530.0810.097-0.0740.1292424.51230.37610.035-0.078-0.1690.022-0.0730.004另由殘差的ACFPACF顯示無自相關Quan_ARMA48三、以ARMA(1,1)配適:AutocorrelationCheckofResidualsToLagChi-SquareDFPrChiSqAutocorrelations64.6140.3297-0.0790.1580.057-0.037-0.021-0.0881212.81100.23430.051-0.0440.042-0.1270.090-0.2031821.03160.17730
26、.126-0.0990.0620.090-0.1240.1232426.35220.23710.006-0.055-0.1580.059-0.0930.027CorrelationsofParameterEstimatesParameterMA1,1AR1,1MA1,11.0000.117AR1,10.1171.000共線性現象微弱另由殘差的ACFPACF顯示無自相關Quan_ARMA49參數顯著性Is residual white noise?StdErrorAIC, SBCModel_1AR(1)顯著Yes1.089302,304Model_2MA(1)顯著Yes1.054295,298M
27、odel_3ARMA(1,1)顯著,但有一估計值為1,不滿足可逆性Yes1.007287,292在此三模式中,MA(1)最適合資料,選定預測式為Yt=t0.646t-1,S=1.054三模式比較Quan_ARMA50Step 1、平穩性檢測Step 2、遴選模式及診斷Step 3、預測原始資料序列6.5CaseStudyDVDweeklysaleseriesQuan_ARMA51Step1.1、平、平穩性檢測AutocorrelationsLagCovarianceCorrelation-198765432101234567891StdError0234.8521.00000|*|01228.
28、6920.97377|.|*|0.072219.5500.93485|.|*|0.133211.0280.89856|.|*|0.164202.5450.86244|.|*|0.195193.6770.82468|.|*|0.216186.4540.79392|.|*|0.237182.4840.77702|.|*|0.258179.6990.76516|.|*|0.269176.9530.75347|.|*|0.2810174.9700.74502|.|*|0.29Dickey-FullerUnitRootTestsTypeLagsRhoPrRhoTauPrFZeroMean00.45440
29、.79370.780.8800SingleMean0-1.96340.7812-0.840.80510.870.8489Trend0-8.91770.5030-2.180.49622.490.6796原始資料非平原始資料非平穩序列Quan_ARMA52Step1.2、差分一次,平、差分一次,平穩性檢測AutocorrelationsLagCovarianceCorrelation-198765432101234567891StdError07.9163691.00000|*|013.4427830.43489|.|*|0.0790572-0.065133-.00823|.|.|0.092813
30、30.0154370.00195|.|.|0.0928174-0.136313-.01722|.|.|0.0928175-1.889516-.23868|*|.|0.0928376-2.656235-.33554|*|.|0.0965977-0.890803-.11253|.*|.|0.1036258-0.523478-.06613|.*|.|0.104386Dickey-FullerUnitRootTestsTypeLagsRhoPrRhoTauPrFZeroMean0-88.5965.0001-7.76.0001SingleMean0-89.18100.0012-7.78.000130.2
31、60.0010Trend0-89.27420.0005-7.760r60acfdiesdownr110r220pacfdiesdown儲選模式一:AR(1)orARMA(1,1)PartialAutocorrelationsLagCorrelation-19876543210123456789110.43489|.|*|2-0.24339|*|.|30.14715|.|*|4-0.11389|.*|.|5-0.23959|*|.|6-0.14628|*|.|70.08505|.|*.|8-0.15793|*|.|90.03565|.|*.|10-0.05646|.*|.|110.01943|.
32、|.|120.06090|.|*.|PACFQuan_ARMA54Step2.1、模式1AR(1)AR(1)配適結果,殘差仍有自相關現象AutocorrelationCheckofResidualsToLagChi-SquareDFPrChiSqAutocorrelations632.935|t|LagAR1,10.442790.071596.19ChiSqAutocorrelations618.2340.00110.000-0.006-0.0090.045-0.131-0.2991222.07100.01480.054-0.075-0.034-0.0320.0720.0801827.5616
33、0.03560.0840.0000.061-0.1320.002-0.0492432.62220.06750.039-0.081-0.0430.1120.031-0.0593036.71280.12530.0920.093-0.0340.015-0.0490.015AutocorrelationPlotofResidualsLagCovarianceCorrelation-198765432101234567891StdError06.0085391.00000|*|010.000676480.00011|.|.|0.0790572-0.038079-.00634|.|.|0.0790573-
34、0.056140-.00934|.|.|0.07906040.2692430.04481|.|*.|0.0790675-0.785409-.13072|*|.|0.0792266-1.794893-.29872|*|.|0.08056270.3242960.05397|.|*.|0.087211Quan_ARMA56Step2.3、模式3ARwithB,B6,MAwithB配適結果,殘差無自相關現象,AR1,1係數不顯著AutoregressiveFactorsFactor1:1+0.02809B*(1)+0.32725B*(6)MovingAverageFactorsFactor1:1+0.
35、569B*(1)AutocorrelationCheckofResidualsToLagChi-SquareDFPrChiSqAutocorrelations63.3830.33670.015-0.015-0.0250.036-0.134-0.001127.1090.62700.079-0.085-0.030-0.0750.038-0.0131814.65150.47720.134-0.0540.041-0.1280.028-0.0512420.06210.51760.108-0.052-0.0370.0830.021-0.0773024.78270.58690.0840.087-0.0750
36、.018-0.059-0.016CorrelationsofParameterEstimatesParameterMA1,1AR1,1AR1,2MA1,11.0000.752-0.139AR1,10.7521.000-0.010AR1,2-0.139-0.0101.000ConditionalLeastSquaresEstimationParameterEstimateStandardErrortValueApproxPr|t|LagMA1,1-0.569000.10222-5.57.00011AR1,1-0.028090.11684-0.240.81031AR1,2-0.327250.080
37、51-4.06|t|LagMA1,1-0.554650.06761-8.20.00011AR1,1-0.320520.08004-4.00ChiSqAutocorrelations63.1040.54100.008-0.019-0.0130.042-0.1270.000126.83100.74110.093-0.078-0.025-0.0660.044-0.0061813.93160.60390.135-0.0470.048-0.1190.035-0.0412419.71220.60100.116-0.044-0.0300.0940.028-0.0723024.57280.65100.0900
38、.093-0.0710.025-0.050-0.008Quan_ARMA58AutoregressiveFactorsFactor1:1-0.43226B*(1)MovingAverageFactorsFactor1:1-0.28716B*(6)Step2.5、模式5ARwithB,MAwithB6ConditionalLeastSquaresEstimationParameterEstimateStandardErrortValueApproxPr|t|LagMA1,10.287160.079613.610.00046AR1,10.432260.072895.93ChiSqAutocorre
39、lations615.3040.00410.107-0.2470.0130.032-0.135-0.0291221.41100.01840.110-0.053-0.073-0.0510.0290.1081825.61160.05980.117-0.007-0.004-0.094-0.0310.0052432.99220.06200.101-0.058-0.0670.1110.018-0.0943038.56280.08830.1110.112-0.053-0.010-0.017-0.029Quan_ARMA59Step2.6、模式6MA(2)withB&B6MovingAverageFacto
40、rsFactor1:1+0.61177B*(1)-0.32354B*(6)CorrelationsofParameterEstimatesParameterMA1,1MA1,2MA1,11.0000.682MA1,20.6821.000ConditionalLeastSquaresEstimationParameterEstimateStandardErrortValueApproxPr|t|LagMA1,1-0.611770.05499-11.13.00011MA1,20.323540.054765.91ChiSqAutocorrelations62.2440.69120.011-0.004
41、-0.0010.015-0.107-0.039125.87100.8263-0.0690.006-0.058-0.0440.0510.091189.52160.89050.0670.0340.004-0.1070.033-0.0452414.69220.87510.057-0.026-0.0700.1080.046-0.0703020.07280.86180.1150.081-0.0530.033-0.063-0.011Quan_ARMA60參數Is residual white noise?StdErrorAIC, SBCModel_1AR(1)顯著No2.54753.6,756.7Mode
42、l_2ARMA(1,1)顯著No2.45743.9,753.2Model_3AR: B, B6 MA: BAR_B不顯著Yes2.336729.5,741.8Model_4AR: B6 MA: B顯著Yes2.330726.7,732.8Model_5AR: BMA: B6顯著yes2.440741.4,747.6Model_6 MA: B,B6顯著yes2.278719.7,725.9選擇Model6為預測式Step2.7、SummaryQuan_ARMA61Step3預測式Samplemean=59.3Quan_ARMA62ForecastsforvariableyObsForecastS
43、tdError95%ConfidenceLimits16283.15022.279778.682087.618416384.62154.324276.146393.096716484.13005.674573.008395.251716582.76236.760269.512596.012116681.83367.694366.753196.914116781.05998.526664.348197.771816881.05999.018263.384698.735316981.05999.484362.471099.648917081.05999.928661.6002100.519717181.059910.353960.7667101.3532預測未來10星期的預測區間Quan_ARMA63Quan_ARMA64