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
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.
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;
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
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.
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
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
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;
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?
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.
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
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.