<?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: a numerical integration problem in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668547#M5208</link>
    <description>&lt;P&gt;Thanks a lot Ian, all valid comments, I cleared it up and now it works just fine. Thank you and Rick for your collaborative guidance!&lt;/P&gt;</description>
    <pubDate>Sat, 11 Jul 2020 11:48:32 GMT</pubDate>
    <dc:creator>runningneptune</dc:creator>
    <dc:date>2020-07-11T11:48:32Z</dc:date>
    <item>
      <title>a numerical integration problem</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668507#M5203</link>
      <description>&lt;P&gt;Community,&lt;/P&gt;&lt;P&gt;&lt;FONT face="Calibri" color="#000000"&gt;I want to perform a numerical integration for the following integrand&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Calibri" color="#000000"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 311px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47061i31E3C1B4FCE7B058/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;C1, delta11, d1, rho are all scalar, which will be specified explicitly. \phi(u) is the PDF of a standard normal distribution, \Phi() is the CDF of a standard normal distribution. I proposed the following SAS codes, but I failed, so there must be something very wrong. Can you kindly help? Thanks in advance!&lt;/P&gt;&lt;P&gt;*************************************************************************************************&lt;BR /&gt;proc iml;&lt;BR /&gt;start stdn(u);&lt;BR /&gt;&amp;nbsp;pi = constant("Pi");&lt;BR /&gt;&amp;nbsp;z=(1/sqrt(2#pi))#exp((-1/2)#(u#u));&lt;BR /&gt;&amp;nbsp;return(z);&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;start phi(u) global(d1,rho);&lt;BR /&gt;&amp;nbsp;cdf=probnorm((-d1+rho#u)/sqrt(1-rho#rho));&lt;BR /&gt;&amp;nbsp;return(cdf);&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;start grand(u);&lt;BR /&gt;&amp;nbsp;v=phi#stdn;&lt;BR /&gt;&amp;nbsp;return(v);&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;start integral(cc1,ddelta1,dd1,rrho) global(c1,delta1,d1,rho,eps);&lt;BR /&gt;&amp;nbsp;c1=cc1;&lt;BR /&gt;&amp;nbsp;delta1=ddelta1;&lt;BR /&gt;&amp;nbsp;d1=dd1;&lt;BR /&gt;&amp;nbsp;rho=rrho;&lt;BR /&gt;&amp;nbsp;ll=c1-delta1;&lt;BR /&gt;&amp;nbsp;interval=ll||.P;&lt;/P&gt;&lt;P&gt;&amp;nbsp;call quad(final,"grand",interval) eps=eps;&lt;BR /&gt;&amp;nbsp;return(final);&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;eps = 1E-11;&lt;/P&gt;&lt;P&gt;p=integral(1.678, 1, 1.645, 0.6);&lt;BR /&gt;print p;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2020 02:37:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668507#M5203</guid>
      <dc:creator>runningneptune</dc:creator>
      <dc:date>2020-07-11T02:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: a numerical integration problem</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668515#M5204</link>
      <description>&lt;P&gt;"Failed" is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the &amp;lt;&amp;gt; to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data, if any, in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;/&amp;gt; icon or attached as text to show exactly what you have and that we can test code against. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or how do you know it failed?&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2020 04:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668515#M5204</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-07-11T04:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: a numerical integration problem</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668523#M5205</link>
      <description>&lt;P&gt;I have not tried to check the integration itself,&amp;nbsp; but just looking at your code I can see a few issues that need attention.&amp;nbsp; In the module called 'grand'&amp;nbsp; you are attempting to call the modules 'phi' and 'stdn', however both require an argument 'u'.&amp;nbsp; Secondly, you should terminate the IML code with 'quit' instead of 'run'.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2020 08:08:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668523#M5205</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2020-07-11T08:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: a numerical integration problem</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668531#M5206</link>
      <description>&lt;P&gt;As Ian points out, the mistake in the 'grand' function. Try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;start grand(u);
 v=phi(u)#stdn(u);
 return(v);
finish;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 11 Jul 2020 10:18:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668531#M5206</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-07-11T10:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: a numerical integration problem</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668546#M5207</link>
      <description>&lt;P&gt;Thanks a lot Rick, it works. I will reply to Ian to thank him as well.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2020 11:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668546#M5207</guid>
      <dc:creator>runningneptune</dc:creator>
      <dc:date>2020-07-11T11:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: a numerical integration problem</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668547#M5208</link>
      <description>&lt;P&gt;Thanks a lot Ian, all valid comments, I cleared it up and now it works just fine. Thank you and Rick for your collaborative guidance!&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2020 11:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/a-numerical-integration-problem/m-p/668547#M5208</guid>
      <dc:creator>runningneptune</dc:creator>
      <dc:date>2020-07-11T11:48:32Z</dc:date>
    </item>
  </channel>
</rss>

