Hi all,
I am attempting to perform a joint generalized linear mixed model with one binary variable and one continuous variable with proc glimmix. The preferred random effects structure for my binary variable is a random intercept and slope, for my continuous variable I would like to include a random intercept with serial correlation in my random effects structure. Of course, I also want to allow correlation between both random intercepts. In addition, I would like to include different mean structures for both my variables. I would like to model the continuous variable with time, gender and age, and include only time and gender for my binary variable. Is there any possibility to let the random effects structure and/or the mean structure depend on the type of response in proc glimmix?
My data looks like this:
ID | pair | time | gender | age | response | distvar | linkvar |
7420 | 33 | 0 | 1 | 15.23 | 1.00 | Binary | PROBIT |
7420 | 33 | 0 | 1 | 15.23 | 115 | Normal | IDEN |
7919 | 274 | 0 | 2 | 20 | 1.00 | Binary | PROBIT |
7919 | 274 | 0 | 2 | 20 | 108 | Normal | IDEN |
7919 | 275 | 1 | 2 | 20 | 1.00 | Binary | PROBIT |
7919 | 275 | 1 | 2 | 20 | 117 | Normal | IDEN |
And I now have this code:
proc glimmix data=sample method=rspl initglm;
class id distvar pair gender linkvar;
nloptions maxiter=50 technique=newrap;
model response(event='1') = distvar distvar*time
distvar*gender distvar*Age
/noint s dist=byobs(distvar) link=byobs(linkvar);
random int / subject=id group=distvar;
random _residual_/ subject=pair type=UN;
run;
Thanks and best,
Margaux
If you wrap your GLIMMIX code in a macro, perhaps you could get something like what you want. Here is an example of what I am thinking of:
proc glimmix data=for_stats IC=PQ;
by col_order meas_id param unit;
class sex grp_no StudyDay anml_no;
model result_n =
&_COV_if_exists.
grp_no
StudyDay
sex
grp_no*StudyDay
grp_no*sex
studyday*sex
grp_no*StudyDay*sex
;
%if "&&label&i" = "AR(1)" or "&&label&i" = "ARH(1)" or "&&label&i" = "SP(POW)(t)" %then %do;
random intercept / sub = anml_no(sex grp_no);
%end;
random StudyDay / residual type = &&label&i subject=anml_no(sex grp_no);
ods output fitstatistics = fit&i
convergencestatus = convstats&i;
run;
In this case, the macro variable &&label&i is used to add a G side random effect for the three time-series-like possible covariance structures used in the random / residual statement. Possibly you could write something similar that uses the distvar variable as the right hand side of the equality.
SteveDenham
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.