Programming the statistical procedures from SAS

What is the difference between PROC GLM & GENMOD?

Accepted Solution Solved
Reply
Regular Contributor
Posts: 165
Accepted Solution

What is the difference between PROC GLM & GENMOD?

Hello everybody,

I want to regress dummy variables, which are time-based, on volume and use PROC GENMOD and PROC GLM statements to create dummies automatically.

When I fit the same data to GLM and GENMOD, I get different parameter estimates.

 

Here are some examples of my codes:

* Regressing dummy variables on normalized volume variable using calculated volume;
proc genmod data=Sampledata_adjvol;
   class TRD_EVENT_ROUFOR / param=effect;
   model adjusted_volume = TRD_EVENT_ROUFOR / noscale;
   ods select ParameterEstimates;
run;

* Same analysis by using the CLASS statement;
proc glm data=Sampledata_adjvol;
   class TRD_EVENT_ROUFOR;              /* Generates dummy variables internally */
   model adjusted_volume = TRD_EVENT_ROUFOR / solution;
   ods select ParameterEstimates;
quit;

 

Would you please explain why I get different results when I run this two procedures?

 

Thanks in advance.


Accepted Solutions
Solution
‎06-18-2017 05:50 PM
Respected Advisor
Posts: 2,048

Re: What is the difference between PROC GLM & GENMOD?

[ Edited ]
Posted in reply to aminkarimid

These two PROCs use a different model paramterization, but the results really give the same model.

 

If you want the results to match identically, in PROC GENMOD you want

 

class TRD_EVENT_ROUFOR / param=GLM;

 

--
Paige Miller

View solution in original post


All Replies
Solution
‎06-18-2017 05:50 PM
Respected Advisor
Posts: 2,048

Re: What is the difference between PROC GLM & GENMOD?

[ Edited ]
Posted in reply to aminkarimid

These two PROCs use a different model paramterization, but the results really give the same model.

 

If you want the results to match identically, in PROC GENMOD you want

 

class TRD_EVENT_ROUFOR / param=GLM;

 

--
Paige Miller
Regular Contributor
Posts: 165

Re: What is the difference between PROC GLM & GENMOD?

Posted in reply to PaigeMiller

Thanks. I find it very helpful.

Parameterization of Model Effects

 

Super User
Posts: 20,730

Re: What is the difference between PROC GLM & GENMOD?

Posted in reply to aminkarimid

Note that the parameterization methods of GLM/EFFECT are not what you usually find in textbooks. It would be the REF parameterization method that's most commonly seen in textbooks. 

Regular Contributor
Posts: 165

Re: What is the difference between PROC GLM & GENMOD?

Would you please explain more precisely?
Which one is better?
Super User
Posts: 20,730

Re: What is the difference between PROC GLM & GENMOD?

Posted in reply to aminkarimid

There isn't a better, they are different. 

This is a statistical concept though, not really a SAS concept. 

 

http://support.sas.com/kb/37/273.html

 

And see the docs specifically for the CLASS statement of the PROC of interest.

ie PROC GLM

http://documentation.sas.com/?docsetId=statug&docsetTarget=statug_glm_syntax04.htm&docsetVersion=14....

 

 

Respected Advisor
Posts: 2,048

Re: What is the difference between PROC GLM & GENMOD?

Posted in reply to aminkarimid

aminkarimid wrote:
Would you please explain more precisely?
Which one is better?

In the future, could you please indicate which comment your are replying to?

--
Paige Miller
Super User
Posts: 10,205

Re: What is the difference between PROC GLM & GENMOD?

Posted in reply to aminkarimid

The most different thing between GLM and GENMOD is estimating method is different.

GLM is OLS, while GENMOD is MLE .

Respected Advisor
Posts: 2,048

Re: What is the difference between PROC GLM & GENMOD?

[ Edited ]

Ksharp wrote:

The most different thing between GLM and GENMOD is estimating method is different.

GLM is OLS, while GENMOD is MLE .


Certainly this is true in general, but ... in a simple modelling situation such as this, where there are only dummy variable effects to be estimated, and the errors are iid normally distributed, wouldn't MLE and OLS produce the same model?

--
Paige Miller
Super User
Posts: 10,205

Re: What is the difference between PROC GLM & GENMOD?

Posted in reply to PaigeMiller
Sure. MLE and OLS will generate the similar parameter estimator .But they are different estimating method. Aren't you agree with that ?

Regular Contributor
Posts: 165

Re: What is the difference between PROC GLM & GENMOD?

[ Edited ]

So, do you say that the difference between estimated parameters using GENMOD & GLM is because of difference between the method of MLE and OLS in former and latter statements?

Respected Advisor
Posts: 2,048

Re: What is the difference between PROC GLM & GENMOD?

Posted in reply to aminkarimid

As I stated above, I think the difference in coefficients is that you have chosen a different parameterization of the model than the one PROC GLM uses. But these are the same models, when you go to predict you get the exact same predicted values — and in fact if you combine terms in the models to un-do the effect of the different parameterization, you will see that the coefficients are the same in both models.

--
Paige Miller
Super Contributor
Posts: 301

Re: What is the difference between PROC GLM & GENMOD?

Posted in reply to PaigeMiller

I agree that difference in the coefficients are due to difference in the parametrization. The two models specified are the same.

 

But, there are quite big difference in how the two procedure works. Proc genmod use numerical methods to maximize the likelihood functions. Further, there can be differences in p-values as proc genmod use -2LogQ tests, and proc glm use F-tests. If data is normal distributed then proc glm should be used as it is more exact, while the distributions of test statistics in proc genmod are based on approximations.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 12 replies
  • 869 views
  • 1 like
  • 5 in conversation