BookmarkSubscribeRSS Feed
mgx
Obsidian | Level 7 mgx
Obsidian | Level 7

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:


IDpairtimegenderageresponsedistvarlinkvar
7420330115.231.00BinaryPROBIT
7420330115.23115NormalIDEN
791927402201.00BinaryPROBIT
79192740220108NormalIDEN
791927512201.00BinaryPROBIT
79192751220117NormalIDEN

 

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

 

1 REPLY 1
SteveDenham
Jade | Level 19

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

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

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.

Discussion stats
  • 1 reply
  • 508 views
  • 0 likes
  • 2 in conversation