Re: rolling regression (但也不完全算是=.=)

看板Statistics作者時間17年前 (2009/04/14 01:51), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串6/6 (看更多)
看到這麼多人回真是太開心了 謝謝大家的幫忙 ^^ 還有人回我信箱呢~ 感恩!! (回這篇好像會佔版面耶@@ ) 我會加油滴!! : ; : run; : data two; : set one; : keep date Ri Rm; : proc sort; by date; : run; : data three; : set two; : Y1=lag(Ri); : Y2=lag2(Ri); : Y3=lag3(Ri); : X1=lag(Rm); : X2=lag2(Rm); : X3=lag3(Rm); : retain count 0; : count=count+1; : run; : data four; /*expand each observation*/ : set three; : do i=1 to 3; : output; : end; : run; : data five; /*replace i & j column with lag1, lag2, lag3*/ : set four; : j=i; : if i=1 then i=Y1; : if i=2 then i=Y2; : if i=3 then i=Y3; : if j=1 then j=X1; : if j=2 then j=X2; : if j=3 then j=X3; : run; : 這作法是擴張資料 : 之後 就可以跑每一期的回歸(by count) 只到資料處理的部份 : 缺點:資料會膨風 你需要LAG幾期 就會膨風幾倍 : 如果你的是年資料 那應該就還好 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 168.122.31.153

04/14 01:54, , 1F
題外話..熊熊發現原po的英文名字和我前馬子一樣...
04/14 01:54, 1F
文章代碼(AID): #19utkC3w (Statistics)
討論串 (同標題文章)
文章代碼(AID): #19utkC3w (Statistics)