Re: rolling regression (但也不完全算是=.=)
看到這麼多人回真是太開心了
謝謝大家的幫忙 ^^
還有人回我信箱呢~
感恩!!
(回這篇好像會佔版面耶@@ )
我會加油滴!!
: ;
: 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
04/14 01:54, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 6 之 6 篇):