<?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 exponential function in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/exponential-function/m-p/37454#M172</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Woops, I think the issue is that the values in my vector 'p' are too small. :smileysilly: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, in IML, can we assign a value as scalar&amp;nbsp; instead to a (1x1) matrix?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Elvin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 29 Oct 2011 00:27:34 GMT</pubDate>
    <dc:creator>telescopic</dc:creator>
    <dc:date>2011-10-29T00:27:34Z</dc:date>
    <item>
      <title>exponential function</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/exponential-function/m-p/37453#M171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have problem on 'exp' function. Please see the bolded line in code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = &lt;STRONG&gt;exp( (-lamda*Y&lt;I&gt;)**gamma )&amp;nbsp; &lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt;&amp;nbsp; ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where gamma and lamda is (1x1) matrix or scalar. Without "exp", The routine return the value f. But, adding&amp;nbsp; 'exp', it returns error!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error message----------------------------------------------------------------- &lt;/P&gt;&lt;P&gt;ERROR: (execution) Invalid argument to function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; operation : EXP at line 925 column 12&lt;/P&gt;&lt;P&gt; operands&amp;nbsp; : _TEM1004&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_TEM1004&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 col&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (numeric)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 194481&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; statement : ASSIGN at line 925 column 5&lt;/P&gt;&lt;P&gt; traceback : module LOGLIK at line 925 column 5&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot see the reason. Maybe it is due to issue on applying function&amp;nbsp; elementwise versus on a matrix?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Elvin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CODE:&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Data radiotherapy;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input y age gender $ censor_ind;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;7 68 f 1&lt;/P&gt;&lt;P&gt;9 69 f 1&lt;/P&gt;&lt;P&gt;12 68 f&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;12 71 f&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;19 77 m&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;23 70 f&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC IML; &lt;/P&gt;&lt;P&gt;RESET LOG PRINT;&lt;/P&gt;&lt;P&gt;USE radiotherapy VAR _ALL_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ all VAR{y} INTO Y;&lt;/P&gt;&lt;P&gt;READ all VAR{age} INTO AGE;&lt;/P&gt;&lt;P&gt;READ all VAR{gender} INTO GENDER;&lt;/P&gt;&lt;P&gt;READ all VAR{censor_ind} INTO CENSOR_IND;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLOSE radiotherapy;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start LogLik(param) global (Y);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; lamda = param[1];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; gamma = param[2];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; n = nrow(Y);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; f=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DO i=1 to nrow(Y); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = &lt;STRONG&gt;exp( (-lamda*Y&lt;I&gt;)**gamma )&amp;nbsp; &lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt;&amp;nbsp; ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; f=f+a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ( f );&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p={3 4, 6 9};&lt;/P&gt;&lt;P&gt;ans=LogLik(p);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Oct 2011 00:17:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/exponential-function/m-p/37453#M171</guid>
      <dc:creator>telescopic</dc:creator>
      <dc:date>2011-10-29T00:17:16Z</dc:date>
    </item>
    <item>
      <title>exponential function</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/exponential-function/m-p/37454#M172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Woops, I think the issue is that the values in my vector 'p' are too small. :smileysilly: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, in IML, can we assign a value as scalar&amp;nbsp; instead to a (1x1) matrix?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Elvin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Oct 2011 00:27:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/exponential-function/m-p/37454#M172</guid>
      <dc:creator>telescopic</dc:creator>
      <dc:date>2011-10-29T00:27:34Z</dc:date>
    </item>
    <item>
      <title>exponential function</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/exponential-function/m-p/37455#M173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;telescopic wrote:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;By the way, in IML, can we assign a value as scalar&amp;nbsp; instead to a (1x1) matrix?&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1x1 matrices are scalars&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/imlug/64248/HTML/default/viewer.htm#imlug_languagechap_sect001.htm"&gt;http://support.sas.com/documentation/cdl/en/imlug/64248/HTML/default/viewer.htm#imlug_languagechap_sect001.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The main problem with your programme above is that in your likelihood module the result of the calculation of EXP(194481) is too big for the computer to handle. I think you also want to pass rows of &lt;EM&gt;p&lt;/EM&gt; as arguments to LogLik and not the whole matrix. I suppose you have seen Rick's recent blog post. If not, have a look at what he did:&lt;/P&gt;&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2011/10/12/maximum-likelihood-estimation-in-sasiml/"&gt;http://blogs.sas.com/content/iml/2011/10/12/maximum-likelihood-estimation-in-sasiml/&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Oct 2011 14:35:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/exponential-function/m-p/37455#M173</guid>
      <dc:creator>TomTom</dc:creator>
      <dc:date>2011-10-29T14:35:49Z</dc:date>
    </item>
    <item>
      <title>exponential function</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/exponential-function/m-p/37456#M174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By the way, you don't need the loop over all elements of Y.&lt;/P&gt;&lt;P&gt;start LogLik(param) global (Y);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; lamda = param[1];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; gamma = param[2];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; f = sum( exp((-lamda*Y)##gamma) );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; return ( f );&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Oct 2011 14:39:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/exponential-function/m-p/37456#M174</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2011-10-31T14:39:34Z</dc:date>
    </item>
  </channel>
</rss>

