<?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: NLMIXED  Execution error for observation 34. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/NLMIXED-Execution-error-for-observation-34/m-p/232729#M54743</link>
    <description>&lt;P&gt;We&amp;nbsp;cannot reproduce your problem that occurs "for observation 34" because you have not set a seed value for the simulation step. Currently the data are different every time you run the program. To obtain reproducible results, put&lt;/P&gt;
&lt;P&gt;call streaminit(12345);&lt;/P&gt;
&lt;P&gt;as the first line of the program. Also get rid of the call to RANNOR and use RAND("Normal") so that you are using a common stream of random numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With these changes, the "execution error" occurs for observation 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the problem is numerical overflow.&amp;nbsp; Obs 4 has censored=1, so look at that LL formula.&lt;/P&gt;
&lt;P&gt;The initial values imply that the expression&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;-(beta*emu/Sigma**&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;*Q**&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; evaluates to -2E17.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;When you try raise Sigma (which is less than 1) to this huge negative power, the result is too large to fit in a double.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest that you recheck your formulas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Nov 2015 13:52:22 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2015-11-02T13:52:22Z</dc:date>
    <item>
      <title>NLMIXED  Execution error for observation 34.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/NLMIXED-Execution-error-for-observation-34/m-p/232674#M54738</link>
      <description>&lt;P&gt;Hello Please, I simulated the data below, ran NLMIXED but had execution error. Any correction.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data tes;&lt;BR /&gt;seed=-1;&lt;BR /&gt; alpha1 = 1.00;&lt;BR /&gt; beta1 = 0.50;&lt;BR /&gt; do i = 1 to 500;&lt;BR /&gt; lambdaT = 0.25; &lt;BR /&gt; lambdaC= 2.00; &lt;BR /&gt; er=0+(1)*rannor(1);&lt;BR /&gt; t = rand("WEIBULL", 0.75, lambdaT); &lt;BR /&gt; c = rand("WEIBULL", 1.00, lambdaC);&lt;/P&gt;
&lt;P&gt;time = min(t, c); &lt;BR /&gt; censored = (c lt t);&lt;BR /&gt; obs=(t lt c); &lt;BR /&gt; y= alpha1+beta1*t+ er;&lt;BR /&gt; output;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc NLMIXED data=tes;&lt;BR /&gt;parms mux=1 sigmax=1 sigma=0.00003 alpha=1 beta=1 ;&lt;BR /&gt;Q=sqrt(1/sigmax**2+beta**2/sigma**2);&lt;BR /&gt;e=y-alpha-beta*time; emu=y-alpha-beta*mux;&lt;BR /&gt;if censored=0 then LL=(-e**2/sigma**2/2-log(sigma**2*sigmax**2)/2&lt;BR /&gt; -(time-mux)**2/sigmax**2/2);&lt;/P&gt;
&lt;P&gt;if censored=1 then LL=log(1-probnorm(Q*(time-mux-sigma**- (beta*emu/sigma**2*Q**2))))-log(sigma**2+beta**2*sigmax**2) -(emu**2/2**sigma**2)*(1-(beta**2/sigma**2*Q**2));&lt;/P&gt;
&lt;P&gt;model y~general(LL);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LOG FILE&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc NLMIXED data=tes;&lt;BR /&gt;24 parms mux=1 sigmax=1 sigma=0.00003 alpha=1 beta=1 ;&lt;BR /&gt;25 Q=sqrt(1/sigmax**2+beta**2/sigma**2);&lt;BR /&gt;26 e=y-alpha-beta*time; emu=y-alpha-beta*mux;&lt;BR /&gt;27 if censored=0 then LL=(-e**2/sigma**2/2-log(sigma**2*sigmax**2)/2&lt;BR /&gt;28 -(time-mux)**2/sigmax**2/2);&lt;BR /&gt;29&lt;BR /&gt;30 if censored=1 then LL=log(1-probnorm(Q*(time-mux-sigma**-&lt;BR /&gt;30 ! (beta*emu/sigma**2*Q**2))))-log(sigma**2+beta**2*sigmax**2)&lt;BR /&gt;30 ! -(emu**2/2**sigma**2)*(1-(beta**2/sigma**2*Q**2));&lt;BR /&gt;31&lt;BR /&gt;32 model y~general(LL);&lt;BR /&gt;33 *ods output ParameterEstimates=ML;&lt;BR /&gt;34 run;&lt;/P&gt;
&lt;P&gt;NOTE: Execution error for observation 34.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE NLMIXED used (Total process time):&lt;BR /&gt; real time 0.22 seconds&lt;BR /&gt; cpu time 0.20 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 03:43:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/NLMIXED-Execution-error-for-observation-34/m-p/232674#M54738</guid>
      <dc:creator>desireatem</dc:creator>
      <dc:date>2015-11-02T03:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: NLMIXED  Execution error for observation 34.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/NLMIXED-Execution-error-for-observation-34/m-p/232729#M54743</link>
      <description>&lt;P&gt;We&amp;nbsp;cannot reproduce your problem that occurs "for observation 34" because you have not set a seed value for the simulation step. Currently the data are different every time you run the program. To obtain reproducible results, put&lt;/P&gt;
&lt;P&gt;call streaminit(12345);&lt;/P&gt;
&lt;P&gt;as the first line of the program. Also get rid of the call to RANNOR and use RAND("Normal") so that you are using a common stream of random numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With these changes, the "execution error" occurs for observation 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the problem is numerical overflow.&amp;nbsp; Obs 4 has censored=1, so look at that LL formula.&lt;/P&gt;
&lt;P&gt;The initial values imply that the expression&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;-(beta*emu/Sigma**&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;*Q**&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; evaluates to -2E17.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;When you try raise Sigma (which is less than 1) to this huge negative power, the result is too large to fit in a double.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest that you recheck your formulas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 13:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/NLMIXED-Execution-error-for-observation-34/m-p/232729#M54743</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-11-02T13:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: NLMIXED  Execution error for observation 34.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/NLMIXED-Execution-error-for-observation-34/m-p/232743#M54744</link>
      <description>&lt;P&gt;Thanks Rick, Thank you for your help.&lt;/P&gt;
&lt;P&gt;I verified the error in the formula but still having issue as shown below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;data tes;&lt;BR /&gt;&amp;nbsp;call streaminit(12345);&lt;BR /&gt;&amp;nbsp;alpha1 = 1.00;&lt;BR /&gt;&amp;nbsp;beta1 = 0.50;&lt;BR /&gt;&amp;nbsp;do i = 1 to 500;&lt;BR /&gt;&amp;nbsp;lambdaT = 0.25;&lt;BR /&gt;&amp;nbsp;lambdaC= 2.00;&lt;BR /&gt;&amp;nbsp;er=RAND("Normal");&lt;BR /&gt;&amp;nbsp;t = rand("WEIBULL", 0.75, lambdaT);&lt;BR /&gt;&amp;nbsp;c = rand("WEIBULL", 1.00, lambdaC);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;time = min(t, c);&lt;BR /&gt;&amp;nbsp;censored = (c lt t);&lt;BR /&gt;&amp;nbsp;obs=(t lt c);&lt;BR /&gt;&amp;nbsp;y= alpha1+beta1*t+ er;&lt;BR /&gt;&amp;nbsp;output;&lt;BR /&gt;&amp;nbsp;end;&lt;BR /&gt;&amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: The data set WORK.TES has 500 observations and 12 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;proc NLMIXED data=tes;&lt;BR /&gt;&amp;nbsp;parms mux=1 sigmax=1 sigma=0.03 alpha=1 beta=1 ;&lt;BR /&gt;&amp;nbsp;Q=sqrt(1/sigmax**2+beta**2/sigma**2);&lt;BR /&gt;&amp;nbsp;e=y-alpha-beta*time; emu=y-alpha-beta*mux;&lt;BR /&gt;&amp;nbsp;if censored=0 then LL= -log(sigma**2*sigmax**2)/2&lt;BR /&gt;&amp;nbsp;-e**2/sigma**2/2&lt;BR /&gt;&amp;nbsp;-(time-mux)**2/(2*sigmax**2);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;if censored=1 then LL=-log(sigma**2+beta**2*sigmax**2)&lt;BR /&gt;&amp;nbsp;-emu**2*(1-(beta**2)/(sigma**2*Q**2))/(2*sigma**2)&lt;BR /&gt;&amp;nbsp;+ log(1-probnorm(Q*(time-mux-(beta*emu/sigma**2*Q**2))));&lt;BR /&gt;&amp;nbsp;model y~general(LL);&lt;BR /&gt;&amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: Execution error for observation 5.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE NLMIXED used (Total process time):&lt;BR /&gt; real time 0.03 seconds&lt;BR /&gt; cpu time 0.03 seconds&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 14:38:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/NLMIXED-Execution-error-for-observation-34/m-p/232743#M54744</guid>
      <dc:creator>desireatem</dc:creator>
      <dc:date>2015-11-02T14:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: NLMIXED  Execution error for observation 34.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/NLMIXED-Execution-error-for-observation-34/m-p/232747#M54746</link>
      <description>&lt;P&gt;Similar problem. The argument to the PROBNORM function is huge, so&amp;nbsp; 1 - probnorm(...) = 0.&lt;/P&gt;
&lt;P&gt;Consequently, the LOG function is producing an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can debug the problem yourself, by using SAS/IML&amp;nbsp;(or the DATA step) to find out where the errors are occurring. The following program reads Obs 5, then computes the same quantities that you are defining in PROC NLMIXED.&amp;nbsp; The log tells you which expressions are failing, and then you can figure out why:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
use tes;
read point 5 var _NUM_ ;
close;

mux=1; Sigmax=1; Sigma=0.00003; alpha=1; beta=1 ;
Q=sqrt(1/sigmax**2+beta**2/sigma**2);
e=y-alpha-beta*time; 
emu=y-alpha-beta*mux;
t1 = -log(sigma**2+beta**2*sigmax**2);
t2 = emu**2 * (1-(beta**2)/(sigma**2*Q**2)) / (2*sigma**2);
a1 = Q*(time-mux-(beta*emu/sigma**2*Q**2));
print a1;
t3 = log( 1 - probnorm(a1) );

LL= t1 - t2 + t3;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Nov 2015 15:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/NLMIXED-Execution-error-for-observation-34/m-p/232747#M54746</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-11-02T15:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: NLMIXED  Execution error for observation 34.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/NLMIXED-Execution-error-for-observation-34/m-p/232753#M54749</link>
      <description>&lt;P&gt;Thank Rick, Thanks a lot!!!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 15:44:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/NLMIXED-Execution-error-for-observation-34/m-p/232753#M54749</guid>
      <dc:creator>desireatem</dc:creator>
      <dc:date>2015-11-02T15:44:38Z</dc:date>
    </item>
  </channel>
</rss>

