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
- /
- Fitting OLS and GLM with repeated observation

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
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-02-2014 04:58 PM

Hi,

I am comparing different estimation methodologies for a project I am working on.

1. The first model I am estimating is an ols, To get robust standard error for the correlated observations, I used genmod. But then someone told me the genmod routine for calculating robust standard errors are not entirely correct and suggested using glimmix. So I tried that too. My understanding is that the parameter estimates should be same, but I am not getting that. I tried different estimation within glimmix but that did not give similar estimates either. Any thoughts?

**My code:**

*proc genmod data= filename ; *

*class id;*

* model log_y = x1 x2 x3 x4 ; *

*repeated subject=id/type=cs printmle ;*

*proc glimmix data = filename ; *

*class id ;*

*model log_y = x1 x2 x3 x4 / s ; *

*random _residual_ /subject=id type=cs ;run ;*

2. The second model I am estimating is GLM. I used genmod for that as well. To be able to use the same routine for both, I re-estimated glm using glimmix and again I get different parameter estimates. So, any explanation for that will be helpful. my codes are below.

**My code for GLM:**

*proc genmod data= filename ;*

*class id;*

*model y= x1 x2 x3 x4 / dist=gamma link=log;*

*repeated subject= id/type=cs printmle;*

*proc glimmix data = filename; *

*class id ;*

*nloptions maxiter= 50;*

*model y= x1 x2 x3 x4 / dist=gamma link=log; *

*random _residual_ /subject= id type=cs ;*

run ;

Thank you very much.

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

Posted in reply to cd2011

12-03-2014 02:31 PM

When you say you get different estimates, can you present examples? I mean, are the differences in the second or third decimal place, or are they grossly different.

I have been able to get estimations between GENMOD and GLIMMIX to "match", but there is occasionally a trivial difference in the estimates. Be sure to check the log likelihood values and the number of observations analyzed as well.

Steve Denham

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

Posted in reply to SteveDenham

12-09-2014 03:49 PM

Hi Steve,

Thanks for your input. I noticed the differences are at the second decimal places for some and at the third decimal for others. An example given below:

OLS GENMOD GLIMMIX

intercept 5.0117 5.0272

x1 0.5870 0.5464

x2 -0.0216 -0.02112

x3 2.2678 2.2892

GLM GENMOD GLIMMIX

intercept 5.4702 5.5124

x1 0.8672 0.8738

x2 -0.0165 -0.01434

x3 2.0139 1.9925

Also, number of observations are same in both, but I cannot compare log-likelihood since GENMOD with repeated option does not give Log-likelihood values.

Could it be the *type* option within the random statement ? When I do the two methods without the random or repeated options, the answers are same.

- CD

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

Posted in reply to cd2011

12-10-2014 11:09 AM

Deep water here, but...

Look at QICu for GENMOD and AIC for GLIMMIX. Since these are essentially -2 loglikelihood + 2*number of parameters, and the number of parameters should be the same for both approaches, then the difference between these would be the difference in the log likelihoods (or quasi-likelihoods). And for GLIMMIX, with an R-side approach, the information criterion is based on a pseudo-likelihood rather than a quasi-likelihood, but in this case they should be close.

Try changing the optimization technique in GLIMMIX, with an NLOPTIONS statement. GENMOD uses a ridge stabilized Newton-Raphson method, so add the following to your GLIMMIX codes:

nloptions tech=nrridg;

to see if the results are any closer.

Steve Denham

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

Posted in reply to SteveDenham

12-10-2014 01:52 PM

Hi Steve,

I did as you suggested. But the tech=nrridg and the default method gave the same parameter estimates.

At the end of the day, I wanted to make sure the estimation method I am using is doing what I intend it to do, that is getting robust standard error for OLS and estimating GLM with subject correlation. Before I used genmod for that and now I am using GLIMMIX with random residual option. Am I ok to use GLIMMIX for this purpose? It would have been nice if I could test these two approaches giving same results, but somehow I am not getting this.

Thanks for all your help.

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

Posted in reply to cd2011

12-11-2014 02:07 PM

One way to get robust standard errors in GLIMMIX is to specify ddfm=kr2 in the MODEL statement as an option. The Kenward-Roberts adjustment uses Satterthwaite degrees of freedom, and the methods of Prasad-Rao-Kackar-Harville-Jeske to adjust the variance-covariance matrix.

Steve Denham