作者stephanieyou ()
站内Statistics
标题Re: rolling regression (但也不完全算是=.=)
时间Tue Apr 14 01:51:07 2009
看到这麽多人回真是太开心了
谢谢大家的帮忙 ^^
还有人回我信箱呢~
感恩!!
(回这篇好像会占版面耶@@ )
我会加油滴!!
: ;
: 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
1F:→ liton:题外话..熊熊发现原po的英文名字和我前马子一样... 04/14 01:54