Programming the statistical procedures from SAS

glimmix

Reply
N/A
Posts: 1

glimmix

I'm new to SAS and I’m having difficulties asking for a random slope. If anybody has any insight, it would begreatly appreciated. (the first proc works, the second one does not)

datasubtype;                   

input y center study age race gender height weightcat;

datalines;

0 1 1 44 3 1 161 4

1 1 1 61 3 1 137 1

1 1 1 63 2 0 194 4

0 1 1 71 3 1 153 4

0 2 1 66 3 1 198 3

1 2 1 36 2 1 166 4

1 2 1 32 2 0 121 3

1 2 1 45 2 1 128 2

1 3 1 32 2 1 104 1

1 3 1 54 1 0 135 3

0 3 1 47 2 1 106 1

1 3 1 34 3 0 104 2

0 4 2 40 2 0 114 3

0 4 2 60 3 0 183 2

0 4 2 79 2 1 177 2

0 4 2 62 2 0 197 1

1 5 2 58 1 0 189 2

1 5 2 48 1 1 157 4

0 5 2 43 2 1 162 3

0 5 2 68 3 0 135 2

0 6 2 69 2 1 115 3

1 6 2 42 3 0 165 3

0 6 2 30 1 0 150 3

0 6 2 50 1 1 157 2

0 7 3 42 3 0 176 1

0 7 3 31 3 0 183 3

0 7 3 75 1 1 147 2

0 7 3 53 1 0 160 3

1 8 3 45 1 0 100 2

1 8 3 74 2 0 127 4

1 8 3 63 3 1 143 4

1 8 3 64 1 1 131 2

1 9 3 56 1 0 107 2

1 9 3 78 2 1 195 2

0 9 3 35 3 0 182 2

1 9 3 47 1 0 123 3

;

proc glimmix;

classcenter;

modely = height / dist=bin link=logitsolution;

randomintercept / type =un subject= center;

random_residual_;

run;

proc glimmix;

classcenter;

modely = height / dist=bin link=logitsolution;

randomintercept height / type =un subject= center;

random_residual_;

run;

Valued Guide
Valued Guide
Posts: 673

glimmix

Use:

model y = height / dist=bin link=logit s;

random int height / sub=center type=un;

random _residual_;

This will give you a random coefficient model (with random effects for intercept and slope).

Contributor
Posts: 24

glimmix

I'm using the similar statements on SAS on Unix platform. I've 500,000 different customer ids on which I'm trying to run this program & each is has 5 different observations. But I get the error message that memory is not sufficient. Any suggestions on how to run this successfully will be deeply appreciated.

proc glimmix data=xxx;

model y = x1 x2 x3 / dist=bin link=logit solution;

random intercept / subject=id;

run;

Valued Guide
Valued Guide
Posts: 673

glimmix

You will probably not get GLIMMIX to run with that many observations. I suggest you take a random sample of the customers (keeping all the observations for the selected customers), and do the analysis on this sample.

Note: you did not define ID as a factor using a class statement. That is OK, as long as the data are sorted by ID before running GLIMMIX. If not sorted, you could get incorrect results (when you have a small enough sample to get any results).

Frequent Contributor
Frequent Contributor
Posts: 132

glimmix

Valued Guide
Valued Guide
Posts: 673

glimmix

HPMIXED is only for normal data.

Contributor
Posts: 24

Re: glimmix

Thanks for the input. Yes I looked into HPMixed and that just handles issues from proc mixed and not from proc glimmix. I wish I could run this procedure for entire population.

Valued Guide
Valued Guide
Posts: 673

Re: glimmix

One way around this would be to use the macro %hpglimmix written by a sas user (not a sas employee). Just do a google search for %hpglimmix. However, last time I looked, this macro is not yet available for the public. You can always write and ask.

Respected Advisor
Posts: 2,655

Re: glimmix

I don't know if this is possible, because I don't know if there is any way to collapse the data, so that the dependent variable is a proportion rather than a 0/1 for each individual.  If you could collapse and calculate the proportion, then the problem may become tractable, either in GLIMMIX with perhaps a beta or a binomial distribution, or in MIXED after transformation (say, arcsine square root transform).  The random slopes, however, would describe the population that you collapse to.

If you are able to use the %hpglimmix macro, please let the group know how it turns out, and any tweaks you might have had to use to get it to work.

Steve Denham

Contributor
Posts: 24

Re: glimmix

I tried finding %hpglimmix but all the posts on Google point to the same blog. It sounds like a great solution but seems that I'll have to wait.

Valued Guide
Valued Guide
Posts: 673

Re: glimmix

Yes, the macro will not be available for several more months, or later. I suggest you look at a random subset of your data set with the procedure.

New Contributor
Posts: 3

Re: glimmix

I just saw this question and thought the following might help.

If you would like to fit the model without an R side matrix (without the random _residual_ statement in your code) which will lead to a random coefficient model with a G side matrix, I think the non-convergence problem might be resolved using NLOPTIONS. With the given data example above, the following code leads to convergence with four iterations. However, the problem of nonconvergence with very large datasets still remains to be a problem. You have to of course check if that is what you want.

proc glimmix data=subtype;

class center;

model y = height / dist=bin link=logit solution;

random intercept height / type =un subject= center;

nloptions tech=NRRIDG;

run;

Contributor
Posts: 24

Re: glimmix

Let me ask you guys another question as you all are very familiar with this procedure (I don't find many experts on glimmix!).

Glimmix allows for joint modeling of binary and poisson distributed variables (as cited by an example in the documentation). Does it also allow modelling two binary DVs jointly?

Also what if I want to model two DVs jointly in genmod, can I do that?

Thanks a lot.

Respected Advisor
Posts: 2,655

Re: glimmix

I know GLIMMIX can do the joint modeling of variables--follow along the example in the documentation for the binary/poisson, and replace poisson throughout.  Probably have to fix up the dataset so that the variable 'dist' is on each record.

I don't think you can do it in GENMOD, but GLIMMIX should give the same results, assuming that you have no random effects.  If you are doing repeated measures in GENMOD (GEE stuff), you can get approximately similar answers in GLIMMIX with an appropriate RANDOM statement with the residual option.

Steve Denham

Ask a Question
Discussion stats
  • 13 replies
  • 665 views
  • 5 likes
  • 6 in conversation