<?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 NLMIXED Convergence in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/NLMIXED-Convergence/m-p/16852#M426</link>
    <description>In the November 2009 issue of The American Statistician, there is an article called "Nonlinear Models for Longitudinal Data" by Jan Serroyen, Geert Molenberghs, Geert Verbeke, and Marie Davidian. They present some orange tree data obtained from Applied Regression Analysis (3rd ed.) by Draper and Smith (1998) p559. A DATA statement to read in the data follows.&lt;BR /&gt;
&lt;BR /&gt;
data orange;&lt;BR /&gt;
	input time @@;&lt;BR /&gt;
	time = time / 100;&lt;BR /&gt;
	do tree = 1 to 5;&lt;BR /&gt;
		input y @@;&lt;BR /&gt;
		y = y / 100;&lt;BR /&gt;
		output;&lt;BR /&gt;
	end;&lt;BR /&gt;
	datalines;&lt;BR /&gt;
118 30 33 30 32 30&lt;BR /&gt;
484 58 69 51 62 49&lt;BR /&gt;
664 87 111 75 112 81&lt;BR /&gt;
1004 115 156 108 167 125&lt;BR /&gt;
1231 120 172 115 179 142&lt;BR /&gt;
1372 142 203 139 209 174&lt;BR /&gt;
1582 145 203 140 214 177&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
They then try to fit a model (#3 in paper) that uses a logistic function and looks like:&lt;BR /&gt;
&lt;BR /&gt;
y_ij = (beta1 + b_i) / (1 + exp[-(time_ij - beta2) / beta3) + eta_ij&lt;BR /&gt;
&lt;BR /&gt;
where b_i ~ N(0,d11) and eta_ij~N(0,sigma2)&lt;BR /&gt;
&lt;BR /&gt;
They provide the following SAS code to fit this model.&lt;BR /&gt;
&lt;BR /&gt;
proc nlmixed data=orange qpoints=20;&lt;BR /&gt;
	num = beta1 + b_i;&lt;BR /&gt;
	ex = exp(-(time - beta2)/beta3);&lt;BR /&gt;
	den = 1 + ex;&lt;BR /&gt;
	model y ~ normal(num/den,sigma2);&lt;BR /&gt;
	random b_i ~ normal(0,d11) subject=tree;&lt;BR /&gt;
	predict num/den out=pred;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
When I run this code I see the following in the log&lt;BR /&gt;
&lt;BR /&gt;
NOTE: To assign starting values to parameters, use the PARMS statement. The default starting&lt;BR /&gt;
      value of 1.0 is in effect for all parameters.&lt;BR /&gt;
NOTE: FCONV convergence criterion satisfied.&lt;BR /&gt;
NOTE: At least one element of the (projected) gradient is greater than 1e-3.&lt;BR /&gt;
WARNING: The final Hessian matrix is not positive definite, and therefore the estimated&lt;BR /&gt;
         covariance matrix is not full rank and may be unreliable.  The variance of some&lt;BR /&gt;
         parameter estimates is zero or some parameters are linearly related to other&lt;BR /&gt;
         parameters.&lt;BR /&gt;
NOTE: The data set WORK.PRED has 35 observations and 11 variables.&lt;BR /&gt;
NOTE: PROCEDURE NLMIXED used (Total process time):&lt;BR /&gt;
      real time           0.59 seconds&lt;BR /&gt;
      cpu time            0.32 seconds&lt;BR /&gt;
&lt;BR /&gt;
The parameter estimates are:&lt;BR /&gt;
&lt;BR /&gt;
  beta1        1.2557&lt;BR /&gt;
  beta2        1.6872&lt;BR /&gt;
  beta3        1.2839&lt;BR /&gt;
  sigma2     1.11E-12  &lt;BR /&gt;
  d11          0.1986   &lt;BR /&gt;
&lt;BR /&gt;
which are no where near the authors estimates of&lt;BR /&gt;
&lt;BR /&gt;
1.921&lt;BR /&gt;
7.279&lt;BR /&gt;
3.481&lt;BR /&gt;
0.006&lt;BR /&gt;
0.100&lt;BR /&gt;
&lt;BR /&gt;
respectively. Even when I try to provide initial parameter estimate that are close these values &lt;BR /&gt;
&lt;BR /&gt;
parms beta1=2 beta2=7 beta3=3 d11=0.1 sigma2=0.006;&lt;BR /&gt;
&lt;BR /&gt;
The estimation fails with the following log output:&lt;BR /&gt;
&lt;BR /&gt;
ERROR: QUANEW Optimization cannot be completed.&lt;BR /&gt;
WARNING: Optimization routine cannot improve the function value.&lt;BR /&gt;
NOTE: The data set WORK.PRED has 0 observations and 0 variables.&lt;BR /&gt;
WARNING: Data set WORK.PRED was not replaced because new file is incomplete.&lt;BR /&gt;
NOTE: PROCEDURE NLMIXED used (Total process time):&lt;BR /&gt;
      real time           0.56 seconds&lt;BR /&gt;
      cpu time            0.45 seconds&lt;BR /&gt;
&lt;BR /&gt;
Can anyone spot any coding errors I may have made or any other ways the estimation process could be helped along. I would really like to be able to fit a logistic function in this manner.&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
    <pubDate>Fri, 13 Nov 2009 22:59:13 GMT</pubDate>
    <dc:creator>sfleming</dc:creator>
    <dc:date>2009-11-13T22:59:13Z</dc:date>
    <item>
      <title>NLMIXED Convergence</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/NLMIXED-Convergence/m-p/16852#M426</link>
      <description>In the November 2009 issue of The American Statistician, there is an article called "Nonlinear Models for Longitudinal Data" by Jan Serroyen, Geert Molenberghs, Geert Verbeke, and Marie Davidian. They present some orange tree data obtained from Applied Regression Analysis (3rd ed.) by Draper and Smith (1998) p559. A DATA statement to read in the data follows.&lt;BR /&gt;
&lt;BR /&gt;
data orange;&lt;BR /&gt;
	input time @@;&lt;BR /&gt;
	time = time / 100;&lt;BR /&gt;
	do tree = 1 to 5;&lt;BR /&gt;
		input y @@;&lt;BR /&gt;
		y = y / 100;&lt;BR /&gt;
		output;&lt;BR /&gt;
	end;&lt;BR /&gt;
	datalines;&lt;BR /&gt;
118 30 33 30 32 30&lt;BR /&gt;
484 58 69 51 62 49&lt;BR /&gt;
664 87 111 75 112 81&lt;BR /&gt;
1004 115 156 108 167 125&lt;BR /&gt;
1231 120 172 115 179 142&lt;BR /&gt;
1372 142 203 139 209 174&lt;BR /&gt;
1582 145 203 140 214 177&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
They then try to fit a model (#3 in paper) that uses a logistic function and looks like:&lt;BR /&gt;
&lt;BR /&gt;
y_ij = (beta1 + b_i) / (1 + exp[-(time_ij - beta2) / beta3) + eta_ij&lt;BR /&gt;
&lt;BR /&gt;
where b_i ~ N(0,d11) and eta_ij~N(0,sigma2)&lt;BR /&gt;
&lt;BR /&gt;
They provide the following SAS code to fit this model.&lt;BR /&gt;
&lt;BR /&gt;
proc nlmixed data=orange qpoints=20;&lt;BR /&gt;
	num = beta1 + b_i;&lt;BR /&gt;
	ex = exp(-(time - beta2)/beta3);&lt;BR /&gt;
	den = 1 + ex;&lt;BR /&gt;
	model y ~ normal(num/den,sigma2);&lt;BR /&gt;
	random b_i ~ normal(0,d11) subject=tree;&lt;BR /&gt;
	predict num/den out=pred;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
When I run this code I see the following in the log&lt;BR /&gt;
&lt;BR /&gt;
NOTE: To assign starting values to parameters, use the PARMS statement. The default starting&lt;BR /&gt;
      value of 1.0 is in effect for all parameters.&lt;BR /&gt;
NOTE: FCONV convergence criterion satisfied.&lt;BR /&gt;
NOTE: At least one element of the (projected) gradient is greater than 1e-3.&lt;BR /&gt;
WARNING: The final Hessian matrix is not positive definite, and therefore the estimated&lt;BR /&gt;
         covariance matrix is not full rank and may be unreliable.  The variance of some&lt;BR /&gt;
         parameter estimates is zero or some parameters are linearly related to other&lt;BR /&gt;
         parameters.&lt;BR /&gt;
NOTE: The data set WORK.PRED has 35 observations and 11 variables.&lt;BR /&gt;
NOTE: PROCEDURE NLMIXED used (Total process time):&lt;BR /&gt;
      real time           0.59 seconds&lt;BR /&gt;
      cpu time            0.32 seconds&lt;BR /&gt;
&lt;BR /&gt;
The parameter estimates are:&lt;BR /&gt;
&lt;BR /&gt;
  beta1        1.2557&lt;BR /&gt;
  beta2        1.6872&lt;BR /&gt;
  beta3        1.2839&lt;BR /&gt;
  sigma2     1.11E-12  &lt;BR /&gt;
  d11          0.1986   &lt;BR /&gt;
&lt;BR /&gt;
which are no where near the authors estimates of&lt;BR /&gt;
&lt;BR /&gt;
1.921&lt;BR /&gt;
7.279&lt;BR /&gt;
3.481&lt;BR /&gt;
0.006&lt;BR /&gt;
0.100&lt;BR /&gt;
&lt;BR /&gt;
respectively. Even when I try to provide initial parameter estimate that are close these values &lt;BR /&gt;
&lt;BR /&gt;
parms beta1=2 beta2=7 beta3=3 d11=0.1 sigma2=0.006;&lt;BR /&gt;
&lt;BR /&gt;
The estimation fails with the following log output:&lt;BR /&gt;
&lt;BR /&gt;
ERROR: QUANEW Optimization cannot be completed.&lt;BR /&gt;
WARNING: Optimization routine cannot improve the function value.&lt;BR /&gt;
NOTE: The data set WORK.PRED has 0 observations and 0 variables.&lt;BR /&gt;
WARNING: Data set WORK.PRED was not replaced because new file is incomplete.&lt;BR /&gt;
NOTE: PROCEDURE NLMIXED used (Total process time):&lt;BR /&gt;
      real time           0.56 seconds&lt;BR /&gt;
      cpu time            0.45 seconds&lt;BR /&gt;
&lt;BR /&gt;
Can anyone spot any coding errors I may have made or any other ways the estimation process could be helped along. I would really like to be able to fit a logistic function in this manner.&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Fri, 13 Nov 2009 22:59:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/NLMIXED-Convergence/m-p/16852#M426</guid>
      <dc:creator>sfleming</dc:creator>
      <dc:date>2009-11-13T22:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: NLMIXED Convergence</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/NLMIXED-Convergence/m-p/16853#M427</link>
      <description>Ah, I like a problem with a simple solution.  Sort the data by TREE prior to invoking the NLMIXED procedure.  You will then get the results reported by Serroyen et al.  Below is a note from the NLMIXED RANDOM statement documentation which discusses this requirement:&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;NOTE:&lt;/B&gt; The input data set must be clustered according to the SUBJECT= variable. One easy way to accomplish this is to sort your data by the SUBJECT= variable prior to calling PROC NLMIXED. PROC NLMIXED does not sort the input data set for you; rather, it processes the data sequentially and considers an observation to be from a new subject whenever the value of its SUBJECT= changes from the previous observation.</description>
      <pubDate>Mon, 16 Nov 2009 21:07:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/NLMIXED-Convergence/m-p/16853#M427</guid>
      <dc:creator>Dale</dc:creator>
      <dc:date>2009-11-16T21:07:35Z</dc:date>
    </item>
  </channel>
</rss>

