<?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 Integration of a function including Chi-square in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/299932#M3007</link>
    <description>&lt;P&gt;I want to integral this function&amp;nbsp;&lt;SPAN&gt;(1-chi-square(x/2,df=10))**5 by the&amp;nbsp;chi-square(&lt;SPAN&gt;x, df=10), so I write the code below. However, the error showed up. Can any one help me solve this problem?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc iml;&lt;/P&gt;&lt;P&gt;start integrand(probchi(x,10));&lt;/P&gt;&lt;P&gt;return ((1-probchi((x/2),10))**5);&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;call quad(answer, "integrand", {0 .P});&lt;/P&gt;&lt;P&gt;print answer;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Sep 2016 18:45:48 GMT</pubDate>
    <dc:creator>Yang</dc:creator>
    <dc:date>2016-09-21T18:45:48Z</dc:date>
    <item>
      <title>Integration of a function including Chi-square</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/299932#M3007</link>
      <description>&lt;P&gt;I want to integral this function&amp;nbsp;&lt;SPAN&gt;(1-chi-square(x/2,df=10))**5 by the&amp;nbsp;chi-square(&lt;SPAN&gt;x, df=10), so I write the code below. However, the error showed up. Can any one help me solve this problem?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc iml;&lt;/P&gt;&lt;P&gt;start integrand(probchi(x,10));&lt;/P&gt;&lt;P&gt;return ((1-probchi((x/2),10))**5);&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;call quad(answer, "integrand", {0 .P});&lt;/P&gt;&lt;P&gt;print answer;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2016 18:45:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/299932#M3007</guid>
      <dc:creator>Yang</dc:creator>
      <dc:date>2016-09-21T18:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Integration of a function including Chi-square</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/299937#M3008</link>
      <description>&lt;P&gt;So that we can all use the same terminology, please review &lt;A href="http://blogs.sas.com/content/iml/2011/10/19/four-essential-functions-for-statistical-programmers.html" target="_self"&gt;"The four essential functions for statistical programmers."&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;For the chi-square distribution, the CDF at x is the integral of the PDF from 0 to x.&amp;nbsp;It looks like you want your integrand to be&lt;/P&gt;
&lt;P&gt;(1 - CDF("ChiSq", x, 10))**5, and the domain of integration to be [0, infinity).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, then your code is almost right. Just a slight modification of the calling syntax (and I use CDF instead of PROBCHI):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
start integrand(x);
   return (1-cdf("ChiSq", x/2,10))##5 ;
finish;
call quad(answer, "integrand", {0 .P});
print answer;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Sep 2016 19:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/299937#M3008</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-09-21T19:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Integration of a function including Chi-square</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/299939#M3009</link>
      <description>&lt;P&gt;Thank you! Yes, this is very helpful. But I want the "Integrand (&lt;SPAN&gt;CDF("ChiSq", x/2, 10)&lt;/SPAN&gt;)" instead of&amp;nbsp;&lt;SPAN&gt;Integrand (x&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;). In other word, I want "dCDF("ChiSq", x/2, 10)" instead of "dx". How should I do that?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2016 19:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/299939#M3009</guid>
      <dc:creator>Yang</dc:creator>
      <dc:date>2016-09-21T19:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Integration of a function including Chi-square</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/299944#M3010</link>
      <description>&lt;P&gt;Sorry, but I don't understand your notation. &amp;nbsp;I don't know what "dCDF" means, unless you mean PDF, which is the derivative of the CDF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Integrand function evaluates a function at a value of x. It returns a number.&amp;nbsp;The QUAD function integrates that function on a (possibly infinite) interval. It returns the definite integral of the function&amp;nbsp;on&amp;nbsp;the&amp;nbsp;interval.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2016 19:38:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/299944#M3010</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-09-21T19:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Integration of a function including Chi-square</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/300022#M3011</link>
      <description>&lt;PRE&gt;
Maybe you should calculated it by hand firstly.
Assuming CDF("ChiSq", x/2, 10)= e^x , then
dCDF("ChiSq", x/2, 10)= e^x * dx 

&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Sep 2016 02:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/300022#M3011</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-09-22T02:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Integration of a function including Chi-square</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/300083#M3014</link>
      <description>&lt;P&gt;If F(x) is the cumulative distribution function and f(x) is the associated density, then one iterpretation of "dCDF" is&lt;/P&gt;
&lt;P&gt;dF = dF/dx * dx = f(x) dx&lt;/P&gt;
&lt;P&gt;which is why I suggested using the PDF function. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, if the argument to F is itself a function of x, say u(x), then make sure you use the chain rule. For example, if the argument is u(x) then&amp;nbsp;&lt;/P&gt;
&lt;P&gt;d(F(u(x)) = dF/du * du/dx * dx = f(u(x))&amp;nbsp;*&amp;nbsp;u`(x) dx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 11:44:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Integration-of-a-function-including-Chi-square/m-p/300083#M3014</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-09-22T11:44:19Z</dc:date>
    </item>
  </channel>
</rss>

