BookmarkSubscribeRSS Feed
anthonywang
Obsidian | Level 7

I have 100 simulated data with sample size=200, # repeated measures=4, binary random effects, and fixed effects includes intercept, sqrt(time), treatment(binary) and interaction of sqrt(time)*treatment.

My purpose is simply to fit this logistic mixed effects model to obtain random effects (intercept and slope of sqrt(time)) for all 100 simulated data sets.

 

I tried to use GLIMMIX to fit this model using "QUAD" (ADAPTIVE QUADRATURE) and I tried Qpoint=11, 21 and non-specified.

I also tried to use "LAPLACE".  The convergence rate are generally small, especially when I use same setting but with 50 sample size (I know that small sample size will cause serious convergence issue, but is there a way to improve?), error message of non-convergence shows in lots of  simulated data sets.

 

The model is fixed because I am basically conducting an comparison with the same model.

Could someone help me with any idea of how to improve, maybe with other methods, please?

 

I attached the error message, simulated data (sample size 200) and code I used including some IML code to prepare the modeling fitting.

 

I really appreciate any help and advise.

 

/*data*/

proc import datafile = 'C:*****\true_response_y.csv'     out = work.true_response_y  dbms = CSV; run;

proc import datafile = 'C:*****\trtdata.csv'             out = work.true_trt  dbms = CSV; run;




proc iml;

/*binary response y*/
use true_response_y;
   read all var _ALL_ into Ydata;
/*binary treatment*/
use true_trt;
   read all var _ALL_ into true_trt;


/*100 simulations*/
w=ncol(Ydata);

n=4; 

SampSize=200;


Y   = shape(t(Ydata),SampSize*n*w,1);
trt = shape(t(true_trt),SampSize*n*w,1);


time = {0,1,3,6};
sqrt_time = sqrt(time);
time_vec = shape(repeat(time,SampSize),SampSize*n,1);
sqrt_time_vec = shape(repeat(sqrt_time,SampSize),SampSize*n,1);; 

ID = shape(t(repeat(1:SampSize,n)),SampSize*n,1);

dataset1 = ID||time_vec||sqrt_time_vec;
/*print dataset1;*/

dataset2 = repeat(dataset1,w);
/*print dataset2;*/

sim = shape(t(repeat(1:w,SampSize*n)),SampSize*n*w,1);
/*print sim;*/

dataset = sim||Y||trt||dataset2;
/*print dataset;*/


/** create data set **/
varNames = {"sim","Y","trt","ID","time","sqrt_time"};
create MyData from dataset [colname=varNames]; 
append from dataset;        
close MyData; 


/* random intercept&slope logistic regression via GLIMMIX *//*QUAD*/
submit MyData;
ods output SolutionR = rnds  ConvergenceStatus=ConvergeStatus;
PROC GLIMMIX DATA=MyData METHOD=QUAD  NOCLPRINT;
CLASS id;
BY sim;
MODEL Y(DESC) = trt sqrt_time trt*sqrt_time / SOLUTION DIST=BINARY LINK=LOGIT;
RANDOM INTERCEPT sqrt_time / SUBJECT=id   TYPE=UN  SOLUTION;
RUN;
endsubmit;

/*LAPLACE*/
submit MyData;
ods output SolutionR = rnds  ConvergenceStatus=ConvergeStatus;
PROC GLIMMIX DATA=MyData METHOD=LAPLACE NOCLPRINT;
CLASS id;
BY sim;
MODEL Y(DESC) = trt sqrt_time trt*sqrt_time / SOLUTION DIST=BINARY LINK=LOGIT;
RANDOM INTERCEPT sqrt_time / SUBJECT=id   TYPE=UN  SOLUTION;
RUN;
endsubmit;

proc print data=ConvergeStatus;  run;

 

 

5 REPLIES 5
anthonywang
Obsidian | Level 7

I have 100 simulated data with sample size=200, # repeated measures=4, binary random effects, and fixed effects includes intercept, sqrt(time), treatment(binary) and interaction of sqrt(time)*treatment. My purpose is simply to fit this logistic mixed effects model to obtain random effects (intercept and slope of sqert(time) for all 100 simulated data sets.

 

I tried to use GLIMMIX to fit this model using "QUAD" (ADAPTIVE QUADRATURE and I tried Qpoint=11, 21 and nonspecified), and also using "LAPLACE", but the convergence rate is really small, error message of non-convergence shows almost in all simulated data sets.

 

The model is fixed because I am basically conducting an comparison with the same model.

Could someone help me with any idea of how to improve, maybe with other methods, please?

 

I attached the error message, simulated data  and code I used including some IML code to prepare the modeling fitting.

 

I really appreciate any help and advise.

 

/*data*/

proc import datafile = 'C:*****\true_response_y.csv'     out = work.true_response_y  dbms = CSV; run;

proc import datafile = 'C:*****\trtdata.csv'             out = work.true_trt  dbms = CSV; run;




proc iml;

/*binary response y*/
use true_response_y;
   read all var _ALL_ into Ydata;
/*binary treatment*/ use true_trt; read all var _ALL_ into true_trt; /*100 simulations*/ w=ncol(Ydata); n=4; SampSize=200; Y = shape(t(Ydata),SampSize*n*w,1); trt = shape(t(true_trt),SampSize*n*w,1); time = {0,1,3,6}; sqrt_time = sqrt(time); time_vec = shape(repeat(time,SampSize),SampSize*n,1); sqrt_time_vec = shape(repeat(sqrt_time,SampSize),SampSize*n,1);; ID = shape(t(repeat(1:SampSize,n)),SampSize*n,1); dataset1 = ID||time_vec||sqrt_time_vec; /*print dataset1;*/ dataset2 = repeat(dataset1,w); /*print dataset2;*/ sim = shape(t(repeat(1:w,SampSize*n)),SampSize*n*w,1); /*print sim;*/ dataset = sim||Y||trt||dataset2; /*print dataset;*/ /** create data set **/ varNames = {"sim","Y","trt","ID","time","sqrt_time"}; create MyData from dataset [colname=varNames]; append from dataset; close MyData; /* random intercept&slope logistic regression via GLIMMIX */
/*QUAD*/ submit MyData; ods output SolutionR = rnds ConvergenceStatus=ConvergeStatus; PROC GLIMMIX DATA=MyData METHOD=QUAD NOCLPRINT; CLASS id; BY sim; MODEL Y(DESC) = trt sqrt_time trt*sqrt_time / SOLUTION DIST=BINARY LINK=LOGIT; RANDOM INTERCEPT sqrt_time / SUBJECT=id TYPE=UN SOLUTION; RUN; endsubmit; /*LAPLACE*/ submit MyData; ods output SolutionR = rnds ConvergenceStatus=ConvergeStatus; PROC GLIMMIX DATA=MyData METHOD=LAPLACE NOCLPRINT; CLASS id; BY sim; MODEL Y(DESC) = trt sqrt_time trt*sqrt_time / SOLUTION DIST=BINARY LINK=LOGIT; RANDOM INTERCEPT sqrt_time / SUBJECT=id TYPE=UN SOLUTION; RUN; endsubmit; proc print data=ConvergeStatus; run;
andreas_lds
Jade | Level 19

Please don't double-post problems. I have merged both.

Posting log as text using {i} icon is highly recommend, many people here won't open office-files.

anthonywang
Obsidian | Level 7
Sorry that I forget to remove the old one, thank you for combining them!
Rick_SAS
SAS Super FREQ

This isn't an IML question. I think it is a question about convergence in GLIMMIX.I'm going to move it to the Statistics Community.

 

I think the problem is that your simulated data do not fit the model you are fitting, or the model is having problems converging when you have only 4 repeated observations. I noticed that if you fit a TYPE=VC covariance matrix (instead of TYPE=UN), then all models converge.

 

Here are a few thoughts on analyzing simulated data:

1. Suppress the ODS output during the analysis

2. Monitor convergence during simulation studies in SAS  (I think you've already read this, or know about it)

3. The PROC MIXED documentation discusses many reasons why a mixed model might fail to converge. Most of those are also applicable to generalized linear mixed models.

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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
  • 5 replies
  • 4628 views
  • 0 likes
  • 3 in conversation