如何使用sas进行Hausman测试?

时间:2017-09-06 20:19:01

标签: sas statistics panel-data

我有面板数据,想要对固定和随机效果进行Hausman测试。 这是我的代码:

Proc glm DATA=Sampledata_adjvol;
 absorb TRD_STCK_CD;
 class TRD_EVENT_ROUFOR;
 model adjusted_volume_5 = TRD_EVENT_ROUFOR / solution;
run;

不使用PROC PANEL或面板程序,我该如何进行测试? 提前谢谢。

1 个答案:

答案 0 :(得分:0)

proc panel data = Sampledata_adjvol3;
    id TRD_STCK_CD DateTime;
    class TRD_EVENT_ROUFOR;
    model adjusted_volume_5 = TRD_EVENT_ROUFOR / fixone;
run;

* Regression with dummy variables in approach 2;
* Creating dummy variables manually;
data Sampledata_adjvol3_1;
  set Sampledata_adjvol3;
        if TRD_EVENT_ROUNDED = 34200 then TRD_EVENT_ROUNDED_1 = 1; 
    else TRD_EVENT_ROUNDED_1 = 0;
    if TRD_EVENT_ROUNDED = 36000 then TRD_EVENT_ROUNDED_2 = 1; 
    else TRD_EVENT_ROUNDED_2 = 0;
    if TRD_EVENT_ROUNDED = 37800 then TRD_EVENT_ROUNDED_3 = 1; 
    else TRD_EVENT_ROUNDED_3 = 0;
    if TRD_EVENT_ROUNDED = 39600 then TRD_EVENT_ROUNDED_4 = 1; 
    else TRD_EVENT_ROUNDED_4 = 0;
    if TRD_EVENT_ROUNDED = 41400 then TRD_EVENT_ROUNDED_5 = 1; 
    else TRD_EVENT_ROUNDED_5 = 0;
    if TRD_EVENT_ROUNDED = 43200 then TRD_EVENT_ROUNDED_6 = 1; 
    else TRD_EVENT_ROUNDED_6 = 0;
run;

proc sort data=Sampledata_adjvol3_1 out=Sampledata_adjvol3_1;
    by TRD_STCK_CD DateTime;
run;
proc tscsreg data= Sampledata_adjvol3_1;
    model adjusted_volume_5 = TRD_EVENT_ROUNDED_1 TRD_EVENT_ROUNDED_2 TRD_EVENT_ROUNDED_3 TRD_EVENT_ROUNDED_4
TRD_EVENT_ROUNDED_5 TRD_EVENT_ROUNDED_6/ fixone;
    id TRD_STCK_CD datetime;
run;