BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bssturgi
Calcite | Level 5

I'm using proc panel to do a one-way random effects model, and the hausman test is not being reported in my results.  SAS is listing the number of coefficients and the degrees of freedom in the Hausman test section of the results, but a "." is showing up for the m statistic.  What does this mean, and what should I do?  There is no error message in my log.  I have included a picture of the results below.  I'm using SAS 9.4. 

 

screen shot_hausman.jpg

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
dw_sas
SAS Employee

After running a test using a character variable that represented the levels of my cross-section variable, rather than an integer variable, I found that PROC PANEL returned the same results as when my cross-section variable was coded as an integer.  Therefore, if you need to run a one-way random effects model on time (rather than cross-section), then your original approach is fine.  You would just need to omit the HCCME= option if you want to see the Hausman m-statistic.

 

I hope this helps, and welcome back to SAS! 🙂   

View solution in original post

13 REPLIES 13
bssturgi
Calcite | Level 5

Here is the code. ln_Rawshare is the dependent variable.  EFWS and ln_h are the regressors.  

 

proc sort data=Pooled_Panel;
by Year Country;
run;

 

proc panel data=Pooled_Panel;
model ln_Rawshare = EFWS ln_h /ranone hccme=1;
id Year Country;
run;

dw_sas
SAS Employee

Thanks for providing the code you are running. 

 

When the HCCME= option is specified, the Hausman test is no longer valid, therefore, the m-statistic is set to missing.  To fit your one-way random effects model and obtain the Hausman test, I would recommend you make the following changes to your code:

 

1)  in the PROC SORT step, change the BY statement to:  BY COUNTRY YEAR;

2)  in the PROC PANEL step,

  • omit the HCCME= option from the MODEL statement, and
  • change the ID statement to:  ID COUNTRY YEAR;

 

I hope this helps!

DW

bssturgi
Calcite | Level 5

OK. Thank you! Removing the HCCME option seems to do the trick, and now I am getting the m-statistic. 

 

I was running a one-way random effects model with respect to time, and that is why I had sorted by Year and then Country. In general, the sorting shouldn't matter, correct?  Or is the Hausman test reported by SAS only valid for Country(cross-section) effects?

dw_sas
SAS Employee

I'm glad that removing the HCCME= option allowed you to obtain the Hausman m-statistic.

 

Regarding your question on fitting a one-way random effects model on time and computing Hausman's test, R&D indicated that your original specification (without the HCCME= option):

 

proc sort data=Pooled_Panel;
by Year Country;
run;

 

proc panel data=Pooled_Panel;
model ln_Rawshare = EFWS ln_h /ranone;
id Year Country;
run;

 

is an acceptable approach, as long as your COUNTRY variable is coded in such a way that it can be inferred as a time variable.  In other words, if the levels of COUNTRY are defined as integer values, then it should be fine. 

 

The Electricity data set in the Getting Started section of the PROC PANEL documentation is an example of a data set where this approach would be acceptable, since the cross-section variable, FIRM, takes on the values 1 thru 6.  The Electricity data set can be found in the following link:

 

http://go.documentation.sas.com/?docsetId=etsug&docsetVersion=14.3&docsetTarget=etsug_panel_gettings... 

 

I hope this helps!

DW

bssturgi
Calcite | Level 5

OK. Thank you again for the reply.

 

I have another question now.

 

My country variable is currently not defined as an integer.  Does this mean my code (posted below):

 

proc sort data=Pooled_Panel;
by Year Country;
run;

 

proc panel data=Pooled_Panel;
model ln_Rawshare = EFWS ln_h /ranone;
id Year Country;
run;

 

is not telling SAS to run a one-way random effects model on time?  Or am I correctly coding for such a model, and you are just saying that because Country is not an integer, the hausman m-statistic is going to be inaccurate?

 

If the code above (with Country NOT an integer) is wrong, I'm not sure what to do.  If I do the following:

 

proc sort data=Pooled_Panel;
by Country Year;
run;

 

proc panel data=Pooled_Panel;
model ln_Rawshare = EFWS ln_h /ranone;
id Country Year;
run;

 

(sort by Country and then Year) then I am going to be estimating a one-way random effects model on Country, correct?  As far as I know, if I sort by Country and then Year, there is no "ranonetime" option or something similar that is analogous to the "fixonetime" option when doing fixed effects.

 

Are you saying that the Country variable(or whatever cross-section variable is being used) always needs to be an integer anytime a random effects model with respect to Year(or whatever time-series variable is being used) is run? Is this also true for a fixed effects model on time?

 

Another way, and perhaps a better way, to ask my question is this.  When it comes to fixed and random effects models (fixed time effects, fixed country effects, random time effects, and random country effects), when is it okay to have the Country variable coded as the country name, and when must it be coded as an integer?

 

I'm sorry to keep pestering you, but I greatly appreciate the help!  I'm switching back to SAS from MATLAB, and I want to make sure my code is giving me what I want it to.

dw_sas
SAS Employee

After running a test using a character variable that represented the levels of my cross-section variable, rather than an integer variable, I found that PROC PANEL returned the same results as when my cross-section variable was coded as an integer.  Therefore, if you need to run a one-way random effects model on time (rather than cross-section), then your original approach is fine.  You would just need to omit the HCCME= option if you want to see the Hausman m-statistic.

 

I hope this helps, and welcome back to SAS! 🙂   

Hollyalways
Calcite | Level 5

Dear dw_sas expert,

 

I have the same problem with bssturgi, it's just a model with ranone option, without HCCME at all... but  m value for Hausman test not being reported in my proc panel results. So would you please give me some advice? Many many thanks.

 

proc sort data=panelD;
by area time;

 

ranone: model PRIOR = MktRF SMB HML RMW CMA / ranone;

 

 

dw_sas
SAS Employee

Hi @Hollyalways

 

Please provide the full PROC PANEL code you are running, along with a sample of your data.  Once we have that information we can better determine the cause of the missing m-statistics.

 

Thanks!

DW

Hollyalways1
Calcite | Level 5

thank you for reply. Attachments are the sample data. Many many thanks. 

 

proc import
datafile="C:\Users\Holly\Desktop\papers\Master\Econometrics\Assignment2\paneldata.xlsx"
out=panel2;
sheet="paneldata1";
run;

 

data panelD;
set panel2;
if time =" " then delete;
if area =" " then delete;
run;

 

proc sort data=panelD;
by area time;
run;

 

proc panel data=panelD;
id area time;

pooled: model PRIOR = MktRF SMB HML RMW CMA / pooled corr;
fixone: model PRIOR = MktRF SMB HML RMW CMA / fixone;
fixonetime: model PRIOR = MktRF SMB HML RMW CMA / fixonetime;
fixtwo: model PRIOR = MktRF SMB HML RMW CMA / fixtwo;
ranone: model PRIOR = MktRF SMB HML RMW CMA / ranone;
rantwo: model PRIOR = MktRF SMB HML RMW CMA / rantwo;
instruments correlated = (HML CMA);
Htaylor: model PRIOR = MktRF SMB HML RMW CMA / htaylor;
run;

quit;

dw_sas
SAS Employee

Thank you for providing the requested information.  For your data and model, the Hausman m statistic was set to missing because the inverse of the difference in the covariance matrices between the fixed and random effects models (needed to compute the m statistic) is not positive definite.

 

Based on the sample data you provided, it appears the data is balanced.  I tried using the Nerlove method to compute the variance component estimates for the RANONE model rather than the default Fuller-Battese method.  In this case the Hausman test was computed, though it had a value of 0 and a p-value of 1.  The syntax I used was:

 

proc panel data=panelD;
id area time;
ranone: model PRIOR = MktRF SMB HML RMW CMA / ranone vcomp=nl;
run;
quit;

 

For more details on the Hausman test statistic and on the methods available for estimating the variance components for the one-way random effects model, see the links below:

 

https://go.documentation.sas.com/?docsetId=etsug&docsetTarget=etsug_panel_details42.htm&docsetVersio...  

 

https://go.documentation.sas.com/?docsetId=etsug&docsetTarget=etsug_panel_details12.htm&docsetVersio...

 

I hope this helps!

DW

 

Hollyalways1
Calcite | Level 5

Dear DW_SAS,

 

You are the savior !! many many thanks indeed for the new knowledge you share in the links !! 

problem solved.

 

Hollyalways

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 13 replies
  • 2978 views
  • 1 like
  • 5 in conversation