<?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: WARNING: PROC NLIN failed to converge in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/WARNING-PROC-NLIN-failed-to-converge/m-p/556517#M27638</link>
    <description>&lt;P&gt;The model you are fitting is essentially&lt;/P&gt;
&lt;P&gt;y = Kx / (1+Kx)&lt;/P&gt;
&lt;P&gt;which passes through the origin and is concave down (second derivative less than 0) for all values of x.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The model does not fit the data for that BY group very well. They look to be linear and not concave down.&amp;nbsp; The optimization routine is trying to choose the parameters so that&lt;/P&gt;
&lt;P&gt;y = S * Kx / (1+Kx)&lt;/P&gt;
&lt;P&gt;the function is "as linear as possible," Two make the second derivative small, K -&amp;gt; 0. But to make the slope nonzero, S -&amp;gt; infinity. Thus no convergence.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The main problem is the third observation for that BY group:&lt;/P&gt;
&lt;P&gt;C 15 3 0.0084038988 0.1596101231&lt;/P&gt;
&lt;P&gt;If the qt value was larger, such as&lt;/P&gt;
&lt;P&gt;C 15 3 0.0084038988 0.23&lt;/P&gt;
&lt;P&gt;then the model would converge for that By group, too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 May 2019 18:27:30 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2019-05-06T18:27:30Z</dc:date>
    <item>
      <title>WARNING: PROC NLIN failed to converge</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/WARNING-PROC-NLIN-failed-to-converge/m-p/556474#M27637</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am having trouble with my code. I have sorption data and trying to fit it to Langmuir Isotherm. There are 5 concentrations (represented by conc in the code) and two plants (C and L). I have 3 blocks which represent the time at which I ran the sorption experiment. qt is the amount sorbed at equilibrium.&lt;/P&gt;&lt;P&gt;When I run the code,&amp;nbsp; I keep getting the error "&amp;nbsp;WARNING: Maximum number of iterations exceeded.&lt;BR /&gt;WARNING: PROC NLIN failed to converge.&lt;BR /&gt;NOTE: The above message was for the following BY group:&lt;BR /&gt;Plant=C block=3"&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried changing the starting parameters and even the method but keep getting that error for that particular block. The data for that block seems fine and there appears to be no anomaly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will appreciate suggestions on how to fix this. Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Isotherm;
input Plant $ conc block ce qt; 
Datalines;
C 5 1 0.0019435976 0.0556402439
C 10 1 0.003973607 0.1026392962
C 15 1 0.0078216918 0.2178308178
C 20 1 0.0116147443 0.338525573
C 25 1 0.0159964979 0.4003502126
C 5 2 0.0018444556 0.0655544441
C 10 2 0.0040143691 0.0985630894
C 15 2 0.0076276945 0.237230553
C 20 2 0.0115231028 0.3476897185
C 25 2 0.0158549932 0.414500684
C 5 3 0.0021044099 0.0395590143
C 10 3 0.0040763926 0.0923607392
C 15 3 0.0084038988 0.1596101231
C 20 3 0.0122161836 0.2783816425
C 25 3 0.016261635 0.3738365034
L 5 1 0.0008449972 0.1655002772
L 10 1 0.0017438207 0.3256179305
L 15 1 0.0036381186 0.6361881362
L 20 1 0.0054052714 0.9594728589
L 25 1 0.0076868098 1.2313190151
L 5 2 0.0008488139 0.1651186053
L 10 2 0.0018084868 0.3191513247
L 15 2 0.00368791 0.6312089972
L 20 2 0.0056812271 0.931877295
L 25 2 0.0080631555 1.1936844505
L 5 3 0.001515348 0.0984651967
L 10 3 0.0028983664 0.2101633637
L 15 3 0.0056429549 0.4357045144
L 20 3 0.0087318841 0.6268115942
L 25 3 0.0120204371 0.797956293
;
title 'Sorption Isotherm: Langmuir';
proc nlin data=Isotherm method=marquardt hougaard;by plant block;
parameters k=1 to 10 by 1 Smax=0.1 to 5 by 0.1;
model qt = ((K*Smax*Ce)/(1+K*Ce)); 
output out=mod1 predicted=pred l95m=l95mean u95m=u95mean 
l95=l95ind u95=u95ind residual=res student=s sse=sse parms=k Smax
run;
Proc Sort Data=mod1;
by conc plant ;
run;
data mod1; set mod1;
proc print data=mod1;
run;
proc means noprint var std stderr uss css;
var qt pred res;
output out = mod2 n=numobs var=qt_v pred_v res_v 
uss=qt_uss pred_uss res_uss css=css
pred_css res_css;
run;
data mod3; set mod1; set mod2;
rsq = 1 - sse/css; *i.e., pseudo rsq;
rmse=sqrt(res_v);
run;
proc print data=mod3;
var rsq rmse;
run;
Title 'Print of parameterestimates';
proc print data=mod1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 May 2019 16:26:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/WARNING-PROC-NLIN-failed-to-converge/m-p/556474#M27637</guid>
      <dc:creator>Tessie</dc:creator>
      <dc:date>2019-05-06T16:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: PROC NLIN failed to converge</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/WARNING-PROC-NLIN-failed-to-converge/m-p/556517#M27638</link>
      <description>&lt;P&gt;The model you are fitting is essentially&lt;/P&gt;
&lt;P&gt;y = Kx / (1+Kx)&lt;/P&gt;
&lt;P&gt;which passes through the origin and is concave down (second derivative less than 0) for all values of x.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The model does not fit the data for that BY group very well. They look to be linear and not concave down.&amp;nbsp; The optimization routine is trying to choose the parameters so that&lt;/P&gt;
&lt;P&gt;y = S * Kx / (1+Kx)&lt;/P&gt;
&lt;P&gt;the function is "as linear as possible," Two make the second derivative small, K -&amp;gt; 0. But to make the slope nonzero, S -&amp;gt; infinity. Thus no convergence.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The main problem is the third observation for that BY group:&lt;/P&gt;
&lt;P&gt;C 15 3 0.0084038988 0.1596101231&lt;/P&gt;
&lt;P&gt;If the qt value was larger, such as&lt;/P&gt;
&lt;P&gt;C 15 3 0.0084038988 0.23&lt;/P&gt;
&lt;P&gt;then the model would converge for that By group, too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 18:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/WARNING-PROC-NLIN-failed-to-converge/m-p/556517#M27638</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-05-06T18:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: PROC NLIN failed to converge</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/WARNING-PROC-NLIN-failed-to-converge/m-p/556583#M27649</link>
      <description>&lt;P&gt;It might be a good idea to reduce the number of estimated parameters. Looking at available estimated values, it looks like blocks for the same plant differ mostly by the K value. So it may make sense to estimate a singe Smax value per plant and a separate K value for each block. This is how you could do it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc nlin data=Isotherm method=marquardt hougaard noitprint best=5;
by plant;
parameters k1=1 to 10 by 1 k2=1 to 10 by 1 k3=1 to 10 by 1 Smax=0.1 to 5 by 0.1;
if block = 1 then K = k1;
else if block = 2 then K = k2;
else if block = 3 then K = k3;
model qt = ((K*Smax*Ce)/(1+K*Ce)); 
output out=isothermPred predicted=pred;
run;


proc sgpanel data=isothermPred;
panelby plant block / layout=lattice;
scatter y=qt x=ce;
series y=pred x=ce;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;------------------------------------- Plant=C --------------------------------------

                                 The NLIN Procedure

                                    Approx       Approximate 95%
      Parameter      Estimate    Std Error      Confidence Limits     Skewness

      k1               8.5985       6.8528     -6.4844     23.6815      0.3503
      k2               9.0683       7.2581     -6.9067     25.0434      0.3693
      k3               7.0638       5.5454     -5.1416     19.2691      0.2843
      Smax             3.4478       2.4736     -1.9965      8.8921      4.4256

------------------------------------- Plant=L --------------------------------------

                                 The NLIN Procedure

                                    Approx       Approximate 95%
      Parameter      Estimate    Std Error      Confidence Limits     Skewness

      k1              38.0343       5.9238     24.9960     51.0726      0.1305
      k2              35.3447       5.4840     23.2744     47.4149      0.1273
      k3              14.5648       2.1192      9.9004     19.2291      0.0782
      Smax             5.4533       0.6910      3.9323      6.9742      0.7988
&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPanel1.png" style="width: 450px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29242i88DFFFA26297E20C/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPanel1.png" alt="SGPanel1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: The correlation among parameter estimates (not shown) is terrible. But the fit is quite reasonable.&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 21:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/WARNING-PROC-NLIN-failed-to-converge/m-p/556583#M27649</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-05-06T21:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: PROC NLIN failed to converge</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/WARNING-PROC-NLIN-failed-to-converge/m-p/556633#M27650</link>
      <description>&lt;P&gt;Thank you. I ran the code as suggested and found no convergence warning.&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 02:19:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/WARNING-PROC-NLIN-failed-to-converge/m-p/556633#M27650</guid>
      <dc:creator>Tessie</dc:creator>
      <dc:date>2019-05-07T02:19:40Z</dc:date>
    </item>
  </channel>
</rss>

