【正文】
1 10 00 39。 u 序列 初始值為零。 定義 x1 序列 初始值為零 sm p l 2 1000 x 1=.8*x 1( 1) +u 39。 定義 x1 序列 初始值為零 sm p l 2 1000 x 2 = u +0 .8* u ( 1) 39。 定義 x 3 序列 初始值為零 s m p l 2 1000 x 3 = 0 .8*x 3 ( 1) + u +0 .8* u ( 1) 39。 定義 x 4 序列 初始值為零 s m p l 2 1000 x 4 =x 4 ( 1) + x 3 39。 生成白噪聲序列 u ~ N ( 0,1 ) u ( 1) =0 39。 定義 x1 序列 初始值為零 se r i e s x 2 39。 定義 x 3 序列 初始值為零 se r i e s x 4 39。 生成 A R ( 1) 序列 x 1= 0 .8*x 1( 1) +u x 2 = u +0 .8* u ( 1) 39。 恢復(fù)為全樣本 查看 u 、 x1 、 x 2 、 x 3 、 x 4 的相關(guān)圖和偏相關(guān)圖。 生成帶有結(jié)構(gòu)突變的 ar ( 1) 序列 p h i = se r i e s x 4 x 4( 1) =0 39。 n e x t ( 2 )計算機(jī)高級語言 M at h e m at i c a 介紹 學(xué)會用模塊語句: M od u l e [ 。則 抽取 第一 對 樣本是 X1* = { x11, x12, …, x1 T} , Y1* = { y11, y12, …, y1 T} 現(xiàn)在隨機(jī) 抽取 N 個 樣本, X2* = { x2 1, x2 2, …, x2 T} , Y2* = { y2 1, y2 2, …, y2 T} X3* = { x3 1, x3 2, …, x3 T} , Y3* = { y3 1, y3 2, …, y3 T} ... XN* = { xN1, xN 2, …, xN T} , YN* = { yN1, yN2, … , yN T} 假設(shè)關(guān)心的是統(tǒng)計量?? j= f ( Xj* , Yj* ) ,那么用 N 組 樣本 值 可以得到一個容量為 N的?? j的估計值序列, {?? 1, ?? 2, …, ?? N} ?? j可以是回歸系數(shù)估計量,也可以是相 應(yīng) t 統(tǒng)計量,相關(guān)系數(shù)等。 f i l e : d yn am i c 1 ( “ 39。 建立工作文件 se r i e s b e t a 11 39。 生成誤差序列 u se r i e s y 39。 生成 y 序列 e q u at i o n e q s y y( 1) 39。 循環(huán) sm p l al l 39。 三不同樣本容量 ( T =20 , 50 , 200 ) 條件下動態(tài)模型自回歸系數(shù)分布的比較 ( 有偏一致估計量 ) ! N =1000 0 w or k f i l e d y n am i c 2 u 1 ! N se r i e s b e t a 11 se r i e s b e t a 12 se r i e s b e t a 13 f or ! i =1 t o ! N sm p l 1 200 se r i e s v= n r n d se r i e s y y( 1) =0 sm p l 2 200 y=.8*y( 1) +v sm p l 1 200 e q u at i o n e q s y y( 1) 39。 畫 b e t a11 直方圖 sh o w b e t a1 2 .h i st 39。 ( 2 )模擬模型回歸系數(shù)有限樣本檢驗統(tǒng)計量的分布特征 【例】 帶漂移項的 A D F 檢驗式中 A D F 、 t ( d r i f t ) 、 t ( d i f f e r ) 分布的模擬 ( 5s i m u df 2 1 ) 數(shù)據(jù)生成過程( D G P ): yt = yt 1 + ut, y0 = 0 , ut ? I I D ( 0, 1 ) , (單位根過程) ADF 檢驗式: D yt = ? + ? yt 1 + ? D yt 1 + ut t ( d r i f t ) A D F t ( d i f f e r ) H0: ? = 0 , ? = 1 , ? = 0 ; H1: ? ? 0 , ? ? 1 , ? ? 0 達(dá)到 未達(dá)到 圖 3 帶漂移項的 A D F 檢驗式中 A D F 、 t ( d r i f t ) 、 t ( d i f f e r ) 分布的 模擬框圖 生成單位根 序列 yt 分析 3 個統(tǒng) 計量的分布 設(shè)定循 環(huán)次數(shù) 估計 A D F 檢驗式 提取 A D F 、 t ( d r i f t ) 、 t ( d i f f e r ) 統(tǒng)計量 E V i e w s 程序如下: 39。( 5s i m u df 2 1 ) 圖 3 t ( d r i f t ) 的 分布是雙峰的,對稱的,其均值仍是 0 。檢驗臨界值不僅與檢驗水平有關(guān),還與樣本容量有關(guān)。有了響應(yīng)面函數(shù),任何樣本容量條件下的臨界值都可以通過響應(yīng)面函數(shù)計算出來。 求 T =20 , 30 , 50 , 100 , 200 , 300 , 5 00 的帶 常數(shù)項的 D F 檢驗式中 t ( d r i f t ) 統(tǒng)計量分布的 % 和 % 臨界值 !N = 1 000 0 w or k f i l e c re v al u e u 1 ! N se r i e s t d r i f t 20 se r i e s t d r i f t 30 se r i e s t d r i f t 50 se r i e s t d r i f t 100 se r i e s t d r i f t 200 se r i e s t d r i f t 300 se r i e s t d r i f t 500 f or ! i =1 t o ! N sm p l 1 5 00 se r i e s v= n r n d v( 1) =0 se r i e s y y( 1) =0 sm p l 2 5 00 y=y ( 1 ) +v e q u at i o n e q 0 1 .l s d ( y) y( 1) c sm p l 20 2 5 00 e q u at i o n e q 0 2 .l s d ( y) y( 1) c sm p l 30 2 5 00 e q u at i o n e q 0 3 .l s d ( y) y( 1) c sm p l 40 2 5 00 e q u at i o n e q 0 4 .l s d ( y) y( 1) c sm p l 45 2 5 00 e q u at i o n e q 0 5 .l s d ( y ) y( 1) c sm p l 47 2 5 00 e q u at i o n e q 0 6 .l s d ( y) y( 1) c sm p l 48 2 5 00 e q u at i o n e q 0 7 .l s d ( y) y( 1) c sm p l al l t d r i f t 500 ( ! i ) = e q 0 1 . t st at s ( 2) t d r i f t 300 ( ! i ) = e q 02. t st at s ( 2) t d r i f t 200 ( ! i ) = e q 0 3 . t st at s ( 2) t d r i f t 100 ( ! i ) = e q 0 4 . t st at s ( 2) t d r i f t 50 ( ! i ) = e q 0 5 . t s t at s ( 2) t d r i f t 30 ( ! i ) = e q 0 6 . t s t at s ( 2) t d r i f t 20 ( ! i ) = e q 0 7 . t s t at s ( 2) n e x t sh o w t d r i f t 500 .h i st sh o w t d r i f t 300 .h i st sh o w t d r i f t 200 .h i st sh o w t d r i f t 100 .h i st sh o w t d r i f t 50 .h i st sh o w t d r i f t 30 .h i st sh o w t d r i f t 2 0 .h i st 39。 任何復(fù)雜形式的模型都可以通過編程用 極大似然估計方法估計出來。( 2 ) 誤差項存在遞增型異方差模型的 極大似然估計 編程 【例】 A R ( 1) 過程 的 極大似然估 計 編程 ( f i l e : l ogL 1 ) 先生成一個 T =1 001 的 ? = 的 A R ( 1) 序列 , 然后通過 極大似然估計方法估計A R ( 1 ) 模型參數(shù)。 生成 A R ( 1 ) 序列 ! N =1001 w or k f i l e l ogl w 1 u 1 ! N se r i e s y y( 1) =0 sm p l f i r st +1 ! N y=+ *y ( 1 ) +n r n d 39。 設(shè)定 l ogl 函數(shù) c A R 1 和 c A R 2 l ogl M L 01 M L p e n d l ogl l ogl 1 M L p e n d r e s= y c ( 1 ) c ( 2 ) *y( 1) M L p e n d l ogl 1=l og( d n or m ( r e s/ se ( 1 ) ) ) l og ( se ( 1) ) 39。 39。 括號部分可以不寫 , 采取默認(rèn)方式。 另一方法是 通過編程,在承認(rèn)存在異方差的條件下,進(jìn)行 極大似然估計。 l og( d n or m ( r e s / s q r t ( var ) ) ) 表示 l og L ( u t * ) 。應(yīng)該建立線性回歸模型。實際中使用參數(shù) O L S 估計結(jié)果為 極大似然估計 量 初始值 賦值是最簡 便的做法。 ( file: logL3) 極大似然估計 M a r q u ar dt 優(yōu)化算法 估計結(jié)果如下: M ar q u ar d t 優(yōu)化算法結(jié)果 極大似然估計 B H H H 優(yōu)化算法 估計結(jié)果如下: B H H H 優(yōu)化算法結(jié)果 c ( 2 ) 的 3 個估計值 ( 540 、 、 7 ) 很接近,但 極大似然估計結(jié)果性質(zhì)更好。圖 1 3 的組