<?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: PROC NLMIXED GENERAL Statement Issues in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330222#M17443</link>
    <description>Such mistake just emphasize why its better to use the built-in functionality whenever possible:-)</description>
    <pubDate>Mon, 06 Feb 2017 15:47:14 GMT</pubDate>
    <dc:creator>JacobSimonsen</dc:creator>
    <dc:date>2017-02-06T15:47:14Z</dc:date>
    <item>
      <title>PROC NLMIXED GENERAL Statement Issues</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330113#M17434</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm fitting a nonlinear mixed-effects model in NLMIXED to a set of longitudinal birth weight data. Because the data is strictly positive, I wanted to model the response with a log-normal distribution. As you may be aware, the log-normal distribution is not a default option in the MODEL statement. So I went ahead and computed the log-likelihood and used the GENERAL statement. Below is the code I used to fit the model:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc nlmixed data = weight gconv = 0;
	parms b0 = 1 b1 = .6 b2 = 1 var0 = .02 cov10 = -.01 var1 = .02 cov20 = -.001 cov21 = -.04 var2 = .4 s2e = .001;
	beta0 = b0 + u0; beta1 = b1 + u1; beta2 = b2 + u2; 
	predv = beta0 + beta1*(1-exp(-beta2*Years));
	pi = arcos(-1);

	ll = (-1/2)*((log(2*pi)) + (log(s2e)) + ((log(Years - predv)**2)/s2e)) + Years;
	model Weightkg ~ general(ll);
	random u0 u1 u2 ~ normal([0,0,0], [var0,cov10,var1,cov20,cov21,var2]) subject = ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When I run the code, this is the error code I receive:&lt;/P&gt;&lt;P&gt;NOTE: Execution error for observation 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've looked around and a possible reason for this error message is that my starting values may be off. I used starting values from fitting the model using Bayesian estimation with PROC MCMC but to no avail. Has anyone ever dealt with this issue and can offer any solutions? Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 07:36:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330113#M17434</guid>
      <dc:creator>tbanh</dc:creator>
      <dc:date>2017-02-06T07:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: PROC NLMIXED GENERAL Statement Issues</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330148#M17437</link>
      <description>&lt;P&gt;I think you have not specified your loglikelihood function correctly. For example, the sign for the quadratic term should be negative. An easier way would be to make a variable inside NLMIXED which is log to your observations. Then use the built-in likelihood for normal distributed data. The two ways to (using log-normal with generel loglikelood, and built-in normal likelihood) is equivalent as I can illustrate with this example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data simulation;
  do i=1 to 100;
    y=exp(rand('normal',0,1));
	output;
  end;
run;

*method 1;
proc nlmixed data=simulation;
  parm mu 0.5;
  z=log(y);
  model  z ~ normal (mu,1);
run;

*method 2;
proc nlmixed data=simulation;
  parm mu 0;	
  pi = arcos(-1);
  s=1;
  ll = -log(2*pi)/2 - log(s) - ((log(y) - mu)/(2*s))**2 - log(y);
  model  y ~ general (ll);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Feb 2017 11:51:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330148#M17437</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2017-02-06T11:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: PROC NLMIXED GENERAL Statement Issues</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330209#M17441</link>
      <description>&lt;P&gt;Hi Jacob,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, they both converge to the same point estimate, but the error estimates and log likelihood estimates don't match up. &amp;nbsp;My brain is sort of fried today, so if you have any ideas why the error estimates differ so drastically...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See, I would pick method 2 based on information criteria, but would end up trading off for wider confidence intervals. &amp;nbsp;That makes me think there may be something missing somewhere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steve Denham&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 15:30:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330209#M17441</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2017-02-06T15:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: PROC NLMIXED GENERAL Statement Issues</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330220#M17442</link>
      <description>&lt;P&gt;I did a mistake, sorry. I scale with 1/2 within the squared term. That should be done outside.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc nlmixed data=simulation;
  parm mu 0;	
  pi = arcos(-1);
  s=1;
  ll = -log(2*pi)/2 - log(s) - ((log(y) - mu)/(s))**2/2 - log(y);
  model  y ~ general (ll);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Feb 2017 15:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330220#M17442</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2017-02-06T15:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: PROC NLMIXED GENERAL Statement Issues</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330222#M17443</link>
      <description>Such mistake just emphasize why its better to use the built-in functionality whenever possible:-)</description>
      <pubDate>Mon, 06 Feb 2017 15:47:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330222#M17443</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2017-02-06T15:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: PROC NLMIXED GENERAL Statement Issues</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330252#M17445</link>
      <description>&lt;P&gt;Whcih is why I don't use NLMIXED as much as I should.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anybody have a spare Gompertz likelihood lying around...?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steve Denham&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 17:47:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330252#M17445</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2017-02-06T17:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: PROC NLMIXED GENERAL Statement Issues</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330261#M17449</link>
      <description>&lt;P&gt;Hi Jacob,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply. I tried your code but I still received this message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Execution error for observation 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that the likelihood isn't the problem?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 18:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330261#M17449</guid>
      <dc:creator>tbanh</dc:creator>
      <dc:date>2017-02-06T18:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: PROC NLMIXED GENERAL Statement Issues</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330468#M17465</link>
      <description>&lt;P&gt;Show the code you run.&lt;/P&gt;
&lt;P&gt;I am confused why "years" is used in the defintion of the predictor (predv), but in the likelihood function it seems that years is your observations you try to predict.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 14:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330468#M17465</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2017-02-07T14:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: PROC NLMIXED GENERAL Statement Issues</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330590#M17469</link>
      <description>&lt;P&gt;Hi Jacob,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for pointing that egregious error. Yes, I mistakenly put Years as my dependent variable when I should have put Weight. The likelihood function works now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I'm running into a new problem. The model I'm running will not converge because I'm providing poor starting values. Do you have any advice on how to fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 19:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330590#M17469</guid>
      <dc:creator>tbanh</dc:creator>
      <dc:date>2017-02-07T19:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: PROC NLMIXED GENERAL Statement Issues</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330740#M17472</link>
      <description>&lt;P&gt;It can be quite difficult to find good starting values. I can not come up with a general good answer, but a few suggestions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Estimate first the parameters in a fixed effect model. Then take these estimate as starting values for the parameters to the mean in the random effect model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, a baysian version of the random effect model can give you some good starting values. You can use proc mcmc almost as you have made proc nlmixed. A mcmc method is often very robust to starting values. The mean values (or max values) from the posterior distribution can then afterwards be used as starting values in proc nlmixed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It can also help if you make it such that the parameters is expected to have same order of magnitude. Otherwise there can easily occur convergence problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 08:28:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-GENERAL-Statement-Issues/m-p/330740#M17472</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2017-02-08T08:28:39Z</dc:date>
    </item>
  </channel>
</rss>

