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

 

 Hello, 

ֲ I wrote the following regression code:

 

proc glm data= reg_roa ;

absorb gvkey01 ;class year;

 

model ROA= T DM DM_X

/noint solution;

run;

quit;/*

I would like to receive the covariance of ֲ the coefficients ֲ of T and DM_X (this covariance will be used in order to test if the sum of coefficients of T and DM_X equal to zero).

 

Do you know what I have to add to my code in order to receive the covariance?

 

Thanks,

Lior

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

I don't know if you can do that when you use an ABSORB statement.  If you have only continuous explanatory variables you can use PROC REG and the COVB option on the MODEL statement:

 

proc glm data= reg_roa ;
model ROA= T DM DM_X /noint COVB;
quit;

 

If you have CLASS variables, you can compute the covariance matrix of the estimates for the nonreference levels of the DUMMY variables. For example,  PROC GENMOD gives a 3x3 covariance matrix for the following model:

 

proc genmod data=sashelp.class plots=none;
class sex;
model weight = sex height / covb;
run;

However, using the ABSORB statement is akin to including a CLASS variable (with many levels) in the model, but it does not include the columns of the dummy variables in the design matrix. (The documentation is somewhat vague on what computation is actually performed.)  Thus I don't think you can get the covariance of the betas when you use the ABSORB statement.

 

 

View solution in original post

9 REPLIES 9
Rick_SAS
SAS Super FREQ

You can use the ESTIMATE statement to test whether the sum of the coefficients is equal to zero. For your model, the statement would look like this:

estimate 'T+DM_X'  T 1 DM_X 1;  

 

 

lioradam
Obsidian | Level 7

Hi Rick,

Thank  you very much for your response,  it was helpful.

however, do you know how to get the covariance of the two coefficients in my code? (I want to compute the t statistic by myself).

 

Regards,

Lior

Rick_SAS
SAS Super FREQ

I don't know if you can do that when you use an ABSORB statement.  If you have only continuous explanatory variables you can use PROC REG and the COVB option on the MODEL statement:

 

proc glm data= reg_roa ;
model ROA= T DM DM_X /noint COVB;
quit;

 

If you have CLASS variables, you can compute the covariance matrix of the estimates for the nonreference levels of the DUMMY variables. For example,  PROC GENMOD gives a 3x3 covariance matrix for the following model:

 

proc genmod data=sashelp.class plots=none;
class sex;
model weight = sex height / covb;
run;

However, using the ABSORB statement is akin to including a CLASS variable (with many levels) in the model, but it does not include the columns of the dummy variables in the design matrix. (The documentation is somewhat vague on what computation is actually performed.)  Thus I don't think you can get the covariance of the betas when you use the ABSORB statement.

 

 

lioradam
Obsidian | Level 7

Hi,

 

Indeed the COVB is not working in my code (with ABSORB).

I will just use the t test  of SAS as you recommend before.

 

Thank you very much!

Lior

lioradam
Obsidian | Level 7

Hi,

I am trying to perform the same estimate procedure your recommend but in other type of regression (Fama MacBeth regression), which look like that :

PROC REG DATA=reg_roa  outest=reg_roa_1 noprint outseb;
 MODEL ROA= T DM  DM_X; 
  by gvkey01 ;
 RUN;QUIT;


proc means data=reg_roa_1 n mean std t probt; where _TYPE_ = 'PARMS'; run;*/

this procedure run  a regression for each firm (gvkey01) separately , and than average the coefficients of all the regressions.

 

I try to add the estimate procedure with no success. maybe I haven't add it properly.

do you know how can I perform the same t test (to verify that the sum of the coefficient of T and DM_X not equal zero) in this regression?

 

Thanks,

Lior

 

Rick_SAS
SAS Super FREQ

You can switch to PROC GLM and use the ESTIMATE statement, or you can use the TEST statement in PROC REG:

TEST  T+DM_X = 0;

lioradam
Obsidian | Level 7

Hi,

 

I did that, and although the log haven't indicate an error, the results do not include the t test. maybe I should add to  the "proc mean data" line this t test as well?

Rick_SAS
SAS Super FREQ

The TEST statement uses an F statistic, which is the square of the t statistic that is produced by the ESTIMATE statement. The p-value for the F test is the same as the p-value for the t test. For example, the following statements display the test in two different ways. 

 

proc reg data=sashelp.class plots=none;
model weight = height age;
test height + age = 0;
ods select TestAnova;
quit;

proc glm data=sashelp.class plots=none;
model weight = height age;
estimate "height+age" height 1 age 1;
ods select Estimates;
quit;

The F statistic in the TestAnova table is the square of the t statistic in the Estimates table (up to rounding). The p-values are equal.

lioradam
Obsidian | Level 7

I did that but receive no results.. probably because this is not a "regular regression" but a method in which the regression is run for each firm separately  and each firm have its own coefficients. so maybe it is not possible to performance t test or F test for the sum of coefficients.

 

Thank you any way for your explanations.

 

Best Regards

Lior

 

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 3176 views
  • 0 likes
  • 2 in conversation