<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ERROR: QUANEW Optimization cannot be completed, for simulated data using logistic mixed model in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578789#M28412</link>
    <description>Sorry that I forget to remove the old one, thank you for combining them!&lt;BR /&gt;</description>
    <pubDate>Fri, 02 Aug 2019 17:52:43 GMT</pubDate>
    <dc:creator>anthonywang</dc:creator>
    <dc:date>2019-08-02T17:52:43Z</dc:date>
    <item>
      <title>ERROR: QUANEW Optimization cannot be completed, for some simulated data using logistic mixed model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578604#M28406</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use GLIMMIX to fit this model using "QUAD" (ADAPTIVE QUADRATURE) and I tried Qpoint=11, 21 and non-specified.&lt;/P&gt;&lt;P&gt;I also tried to use "LAPLACE".&amp;nbsp; 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&amp;nbsp; simulated data sets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The model is fixed because I am basically conducting an comparison with the same model.&lt;/P&gt;&lt;P&gt;Could someone help me with any idea of how to improve, maybe with other methods, please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached the error message, simulated data (sample size 200) and code I used including some IML code to prepare the modeling fitting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate any help and advise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*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&amp;amp;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;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 02:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578604#M28406</guid>
      <dc:creator>anthonywang</dc:creator>
      <dc:date>2019-08-02T02:37:04Z</dc:date>
    </item>
    <item>
      <title>ERROR: QUANEW Optimization cannot be completed, for simulated data using logistic mixed model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578601#M28407</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The model is fixed because I am basically conducting an comparison with the same model.&lt;/P&gt;&lt;P&gt;Could someone help me with any idea of how to improve, maybe with other methods, please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached the error message, simulated data&amp;nbsp; and code I used including some IML code to prepare the modeling fitting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate any help and advise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*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;&lt;BR /&gt;
/*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&amp;amp;slope logistic regression via GLIMMIX */&lt;BR /&gt;/*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;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Aug 2019 02:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578601#M28407</guid>
      <dc:creator>anthonywang</dc:creator>
      <dc:date>2019-08-02T02:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: QUANEW Optimization cannot be completed, for simulated data using logistic mixed model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578621#M28408</link>
      <description>&lt;P&gt;Please don't double-post problems. I have merged both.&lt;/P&gt;
&lt;P&gt;Posting log as text using {i} icon is highly recommend, many people here won't open office-files.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 05:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578621#M28408</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-08-02T05:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: QUANEW Optimization cannot be completed, for some simulated data using logistic mixed mod</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578684#M28409</link>
      <description>&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are a few thoughts on analyzing simulated data:&lt;/P&gt;
&lt;P&gt;1. &lt;A href="https://blogs.sas.com/content/iml/2013/05/24/turn-off-ods-for-simulations.html" target="_self"&gt;Suppress the ODS output during the analysis&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2015/08/26/convergence-sim.html" target="_self"&gt;Monitor convergence during simulation studies in SAS&lt;/A&gt;&amp;nbsp; (I think you've already read this, or know about it)&lt;/P&gt;
&lt;P&gt;3. T&lt;A href="https://go.documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_mixed_details58.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en#statug_mixed017771" target="_self"&gt;he PROC MIXED documentation discusses many reasons why a mixed model might fail to converge&lt;/A&gt;. Most of those are also applicable to generalized linear mixed models.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 13:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578684#M28409</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-08-02T13:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: QUANEW Optimization cannot be completed, for simulated data using logistic mixed model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578789#M28412</link>
      <description>Sorry that I forget to remove the old one, thank you for combining them!&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Aug 2019 17:52:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578789#M28412</guid>
      <dc:creator>anthonywang</dc:creator>
      <dc:date>2019-08-02T17:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: QUANEW Optimization cannot be completed, for some simulated data using logistic mixed mod</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578867#M28414</link>
      <description>&lt;P&gt;Thank you Rick, these are really helpful!&lt;/P&gt;</description>
      <pubDate>Sat, 03 Aug 2019 04:24:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/ERROR-QUANEW-Optimization-cannot-be-completed-for-some-simulated/m-p/578867#M28414</guid>
      <dc:creator>anthonywang</dc:creator>
      <dc:date>2019-08-03T04:24:29Z</dc:date>
    </item>
  </channel>
</rss>

