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

 Hi

 

 Please see the attached sample dataset.  I have run the following regression model with time and firm fixed effects:

 

proc glm data= have;
absorb PERMNO;
class month;
model Buy = Female_Chairman Male_Chairman Female_Director Male_Director Female_ChiefOfficer Male_ChiefOfficer month / solution noint;
run;

PERMNO stands for firms. Buy is the dependent variable, which is equal to 1 when there is a Buy trade, and 0 otherwise. Female_Chairman is a product of female dummy and executive type, and so on. Male_ChiefOfficer is the omitted category.

 

Now I want to apply Wald test/F test to measure a significant difference between coefficients of (Female_Chairman and Male_Chairman) as well as the difference between coefficients of (Female_Director and Male_Director).

 

Kindly help me which code should I use to run Wald test in proc glm? Thanks. 

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

I should first say that you should not use PROC GLM if your response is binary. Tests will be invalid. A logistic model using PROC LOGISTIC might be an appropriate model instead. Since you want to fit a fixed effects model, the STRATA statement in PROC LOGISTIC is the thing to use instead of the ABSORB statement in PROC GLM.

 

In any case, instead of using coded dummy variables for gender and type, create Gender and Type variables with the appropriate levels. Then, if the goal is to compare the genders within each type, you can use a SLICE statement. For example:

 

proc logistic;
strata permno;
class gender type month/param=glm;
model buy=gender|type month;
slice gender*type / sliceby=type;
run;

View solution in original post

13 REPLIES 13
Ksharp
Super User

Sorry. I am not expert about it . Post it at STAT forum, and @StatDave  or @Rick_SAS  could give you a hand .

Saba1
Quartz | Level 8
@Ksharp: thanks for your kind suggestion 🙂
Rick_SAS
SAS Super FREQ

It would be helpful if you post an example of your data. It's not clear to me what values are represented by Chairman, Director, and ChiefOfficer. Your model assumes that they are continuous variables.

 

Also, I think your model can't include the terms

Female*Chairman

and

Male*Chairman

because they are linearly dependent.

 

 

Saba1
Quartz | Level 8
@Rick_SAS: I have attached a sample dataset. Kindly have a look. Thanks.
StatDave
SAS Super FREQ

I should first say that you should not use PROC GLM if your response is binary. Tests will be invalid. A logistic model using PROC LOGISTIC might be an appropriate model instead. Since you want to fit a fixed effects model, the STRATA statement in PROC LOGISTIC is the thing to use instead of the ABSORB statement in PROC GLM.

 

In any case, instead of using coded dummy variables for gender and type, create Gender and Type variables with the appropriate levels. Then, if the goal is to compare the genders within each type, you can use a SLICE statement. For example:

 

proc logistic;
strata permno;
class gender type month/param=glm;
model buy=gender|type month;
slice gender*type / sliceby=type;
run;
Saba1
Quartz | Level 8

@StatDave: Thanks for your guidance. I am using proc glm because I need to apply fixed effect for PERMNO (total number is 4000) and month, both. Would proc logistic do the trick?
The second half of your answer where you ask me to "create Gender and Type variables with the appropriate levels", do you mean that instead of having a product of dummy variables of Male and Female, and three executive types separately, I should rather create one Gender variable  (i.e. 0/1) and one Type variable? But then I have three executive types, how to allocate numbers to them?

 

Please refer to the attached sample dataset. Thanks.

StatDave
SAS Super FREQ

This appears to be the same question as your "SAS "proc" for linear regression" post. PROC GEE is one way to deal with this. The conditional logistic model with the STRATA statement that I mentioned above is another. The STRATA statement does the same thing in concept as the ABSORB statement in GLM, but the model fitting algorithm is entirely different (maximum likelihood vs least squares). 

 

Instead of having separate dummy variables (each coded 0 or 1) for each gender, create a single Gender variable that has values "male" and "female" (or 0 and 1 if you want) and specify that in the CLASS and MODEL statements. Similarly for your Type levels. The CLASS statement creates the dummy variables for you internally. See this note

Saba1
Quartz | Level 8

@StatDave: Thanks. In another post, I have mentioned the issue of difference in results for fixed effects when PERMNO is used in Class statement as compared to Strata Statement.

https://communities.sas.com/t5/Statistical-Procedures/Suitable-quot-proc-quot-for-a-model-with-Dummy...

Secondly, for proc logistic regression (with Slice statement) if I include gender and type variables in the model, in addition to the mentioned interactions, then some of the Maximum Likelihood Estimates are missing. However, I get accurate results by using the code below i.e.  if model consists of only interaction variables.

 

proc logistic;
class gender type/param=glm;
model buy=gender*type ;
slice gender*type / sliceby=type;
run;

I will be thankful for your helpful response.

StatDave
SAS Super FREQ

With GLM parameterization, the model with main effects and interaction and the model with only the interaction are equivalent models. You can see this in the fact that the log likelihood values for the two models are the same as are predicted values under the two models. In the interaction-only model, the degrees of freedom for the omitted main effects are absorbed into the degrees of freedom for the interaction. So, both models are equally "accurate". Concerning missing values, this is always the case with GLM parameterization. An effect with k levels has k-1 degrees of freedom and therefore only k-1 parameters can be estimated. Under GLM parameterization an estimate is presented for all k levels, so a constraint is imposed in which the reference level is set to zero with zero degrees of freedom and its standard error is set to missing.

Saba1
Quartz | Level 8
@StatDave: Thanks. It clarifies in detail.
Saba1
Quartz | Level 8

@StatDave One quick question regarding the same post. In proc glm, which statement performs the same function or gives the same results as "Slice" statement does in proc logistic i.e. 

slice gender*type / sliceby=type;

 

StatDave
SAS Super FREQ

You can still use the SLICE statement, but in PROC PLM following your PROC GLM step. First, fit your model in PROC GLM and include a STORE statement to save the fitted model. Then run PROC PLM using the stored model and specifying the SLICE statement.

Saba1
Quartz | Level 8
@StatDave: Thanks a lot for this help and providing useful information.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 13 replies
  • 3908 views
  • 8 likes
  • 4 in conversation