turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- What is the difference between PROC GLM & GENMOD?

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2017 03:50 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2017 04:17 PM - edited 06-16-2017 05:38 PM

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;

All Replies

Solution

06-18-2017
05:50 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2017 04:17 PM - edited 06-16-2017 05:38 PM

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;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-18-2017 05:50 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2017 04:22 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2017 06:36 PM

Would you please explain more precisely?

Which one is better?

Which one is better?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2017 07:00 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-17-2017 07:07 AM

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2017 11:18 PM

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

GLM is OLS, while GENMOD is MLE .

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-17-2017 07:09 AM - edited 06-17-2017 07:15 AM

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-17-2017 09:03 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-17-2017 02:51 PM - edited 06-17-2017 02:53 PM

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-17-2017 03:56 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-19-2017 08:23 AM

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.