楼主: chicair670310
4177 4

[求助]一个选模的问题 [推广有奖]

  • 0关注
  • 0粉丝

学前班

60%

还不是VIP/贵宾

-

威望
0
论坛币
34 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
70 点
帖子
3
精华
0
在线时间
0 小时
注册时间
2008-4-15
最后登录
2016-8-21

楼主
chicair670310 发表于 2008-4-18 00:23:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

         各位高手,小弟有一个问题想请教,我用一个下载来的code要修改成我想要的,可是我发现,再p=pMAX的地方很怪,p值已经固定,所以跑出来的的SIC,AIC,和HQ皆为落后一期最好,这样是因为我的p直被固定的关西...那我到底要怎样修我的code,p值才不会固定呢...

还有       hp=ipi[2:rows(y),.]~ipi[1:rows(y)-1,.];            dly=100*ln(hp[.,1:n]./hp[.,n+1:2*n]);    是什么..

有人可以帮小弟解释吗...感谢各位大大的帮忙

/* Testing the VAR order selection */

new;
cls;

@ Here the matrix y (nx1) @
format 8,5;
load y[45,1]=y1;
load c[45,2]=c1;
ipi=y~c;
n=cols(ipi);
hp=ipi[2:rows(y),.]~ipi[1:rows(y)-1,.];
dly=100*ln(hp[.,1:n]./hp[.,n+1:2*n]);


"";"";"";"";"";"";"";
"**********************************************************************";"";
"                 Choosing the order of the VAR (p)";"";
"   Enter maximun number of lags you want for the model (p.max): ";"";
"**********************************************************************";

@ Some parameters of interest @

pmax=6;                 @ pmax为落后的期数 @
n=cols(dly);            @ n is the dimension of the VAR @
nk=pmax+1;              @ nk is the first obs for which
                           OLS is calculated @
capt=rows(dly);         @ capt is the original sample size @
captst=capt-pmax;       @ captst is the effective sample size @
resul=zeros(pmax,4);    @ result will include the AIC, BIC and HQ
                           for each lag p @
ome=zeros(n,n);         @ ome will include the VARCOV matrix @


@ OLS estimate of VARCOV @

p=1;

reg=ones(captst,1);
do until p>pmax;
   err=zeros(captst,n);
   reg=reg~dly[nk-p:capt-p,.];    @ reg is the matrix of
                                       regressors @
   k=n+(n*n*p);                     @ k is the total number of
                                       param. to be estimated @
   i=1;
   do until i>n;
      Dy=dly[nk:capt,i];
      err[.,i]=Dy-reg*inv(reg'reg)*reg'Dy;
      i=i+1;
   endo;
   r=1;
   do until r>n;
      c=1;
      do until c>n;
         den=captst-k;
         ome[r,c]=(1/den)*(err[.,r]'err[.,c]);
         c=c+1;
      endo;
      r=r+1;
   endo;

   aka=ln(det(ome))+(2*(n^2)*p/captst);
   sch=ln(det(ome))+(ln(captst)*(n^2)*p/captst);
   hq=ln(det(ome))+(2*ln(ln(captst))*(n^2)*p/captst);
   resul[p,.]=p~aka~sch~hq;
   p=p+1;
endo;

 x1=p[1,1];
@ Output files @

output file=AIC.txt reset;
resul[.,2]-1;
output off;

output file=BIC.txt reset;
resul[.,3];
output off;

output file=HQ.txt reset;
resul[.,4]+1;
output off;


@ Results @
cls;
" ";
"            p            Akaike          Schwartz       Hanan & Quinn  ";
resul;
" ";
end;

在此小弟附上附檔,跪求各位高手请帮小弟解答!

[此贴子已经被作者于2008-4-18 16:07:12编辑过]

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:parameters Effective dimension estimated calculate 求助

沙发
zhaomn200145 发表于 2008-4-18 10:01:00
把程序发上来,就具体问题问题进行讨论,这种形式比较好!希望大家可以就此问题进行一些讨论。参与者会有奖励的哦。

藤椅
chicair670310 发表于 2008-4-19 00:12:00

谢谢版大的帮忙,不好意思我没把的问题好好说清楚,其实我主要的问题是

Akaike          Schwartz       Hanan & Quinn  这三个选模公式的captst

一定固定是capt-pmax???,

也就是说当我样本有30个时,因为我pmax6,所以说captst就是24,那这三个指针是一定要有相同的captst才能比较吗??     

还有就是

     那这里面的回圈设的正确吗????

还有就是

     那这里面的回圈设的正确吗????

 

由于我是新手,希望有高手回答我问题…….

板凳
chicair670310 发表于 2008-4-19 00:35:00

附上程序码

C                  y

15                 15

16                 15

17                 16

17                 15

15                 16

16                 16

16                 17

16                 15

15                 16

16                 17

16                 17

17                 15

15                 16

16                 16

17                 16

17                 15

16                 16

17                 16

17                 17

18                 15

16                 16

17                 16

17                 17

17                 16

16                 17

17                 17

17                 18

18                 16

17                 17

17                 17

报纸
xuelida 在职认证  发表于 2008-5-1 16:19:00

 hp=ipi[2:rows(y),.]~ipi[1:rows(y)-1,.];    是ipi水平连接,由y滞后组成了解释变量矩阵。    

 dly=100*ln(hp[.,1:n]./hp[.,n+1:2*n]);    这不相当于求收益率的公式吗?

pmax=6
应该能修改的

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-30 02:38