异方差/自相关/多重共线性/协整

from:《金融计量学-基于SAS的金融实证研究》chapter4

*异方差;
proc reg data=capm.rip1
outest=capm.beta;
model meanrif=meanrmf;
output out=capm.r r=e;/*把回归残差值赋给变量e*/
by p;
run;
data capm.r;
set capm.r;
r2=e*e;
where p=0;
run;
proc gplot data=capm.r;
plot r2*meanrmf='*';/*r2为垂直坐标,meanrmf为横坐标,用*标记点*/
run;

proc reg data=capm.rip1
outest=capm.beta;
model meanrif=meanrmf/spec;/*spec对模型进行White检验*/
by p;
run;
*autoreg语句;
proc autoreg data=capm.rip1;
   model meanrif=meanrmf /nlag=2 archtest dwprob;
   output out=r r=yresid;
run;
*自相关;
data capm.r;
set capm.r;
lagr=lag(e);/*生成残差的滞后序列lagr*/
where p=0;
run;
proc gplot data=capm.r;
plot e*lagr='*';/*e为纵坐标,lagr为横坐标*/
run;

/* Durbin-Watson检验  */
proc reg data=capm.rip1
outest=capm.beta;
model meanrif=meanrmf/dw;
by p;
run;
*or;
proc autoreg data=capm.rip1
outest=capm.beta;
model meanrif=meanrmf/dw=2 dwprob;
by p;
run;

/*多重共线性*/
/* 相关系数 */
proc reg data=capm.rip1
outest=capm.beta;
model meanrif=meanrmf/corrb;/*输出参数估计的相关阵*/
by p;
run;

/* VIF和TOL */
proc reg data=capm.rip1
outest=capm.beta;
model meanrif=meanrmf/VIF TOL;/*输出VIF和TOL */
by p;
run;

/* 逐步回归判别法  */
proc reg data=capm.rip1
outest=capm.beta;
model meanrif=meanrmf/Selection=Stepwise Slentry=0.5;/*选用逐步回归判别法,显著性水平在0.5*/
by p;
run;

协整

libname econ 'f"\fe';
/*Cointegration Tests*/
/*EG两步法*/
proc arima data=ecom.cpi;
identify var=cpi_cn0 stationarity=(adf=3);
identify var=ppi_cn0 stationarity=(adf=3);
identify var= cpi_cn0(1) stationarity=(adf=3);
identify var= ppi_cn0(1) stationarity=(adf=3);
run;quit;
ods rtf file="F:\Results.doc";
proc reg data=ecom.cpi;
model cpi_cn0=ppi_cn0 / dw;
output out=egres residual=res;
run;quit;
ods rtf close;
proc arima data=egres;
identify var=res stationarity=(adf=3);
run;quit;

/*Johansen Test*/
data var;
set ecom.cpi;
rici2=rici/lag(rici)*100;
ppi_us2=ppi_us/lag(ppi_us)*100;
cpi_us2=cpi_us/lag(cpi_us)*100;
rici1=rici/lag12(rici)*100;
ppi_us1=ppi_us/lag12(ppi_us)*100;
cpi_cn1=cpi_cn0/lag12(cpi_cn0)*100;
run;
data var;
set var;
where rici2^=. and ppi_us2^=.;
run;
proc varmax data=var;
model rici ppi_us /p=3 cointtest=(johansen=(type=trace)) noint;
run; quit;
ods rtf file="F:\Results.doc";
proc varmax data=var;
model rici ppi_cn0 cpi_cn0/p=3 cointtest=(johansen=(type=trace)) ;
run; quit;
ods rtf close;




 


你可能感兴趣的:(异方差/自相关/多重共线性/协整)