<?xml version="1.0" encoding="UTF-8"?>

<!--
 *
 * This help file was generated from distfun_betapdf.sci using help_from_sci().
 *
 -->

<refentry version="5.0-subset Scilab" xml:id="distfun_betapdf" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:ns3="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:scilab="http://www.scilab.org"
          xmlns:db="http://docbook.org/ns/docbook">

  <refnamediv>
    <refname>distfun_betapdf</refname>
    <refpurpose>Beta PDF</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Calling Sequence</title>
   <synopsis>
   y = distfun_betapdf ( x , a , b )
   
   </synopsis>
</refsynopsisdiv>

<refsection>
   <title>Parameters</title>
   <variablelist>
   <varlistentry><term>x :</term>
      <listitem><para> a matrix of doubles, the outcome. Should be in the [0,1] interval.</para></listitem></varlistentry>
   <varlistentry><term>a :</term>
      <listitem><para> a matrix of doubles, the first shape parameter, a>=0.</para></listitem></varlistentry>
   <varlistentry><term>b :</term>
      <listitem><para> a matrix of doubles, the second shape parameter, b>=0.</para></listitem></varlistentry>
   <varlistentry><term>y :</term>
      <listitem><para> a matrix of doubles, the density</para></listitem></varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Description</title>
   <para>
Computes the Beta probability distribution function.
   </para>
   <para>
Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.
   </para>
   <para>
Let us denote by B the Beta function. The function definition is:
   </para>
   <para>
<latex>
\begin{eqnarray}
f(x,a,b) = \frac{1}{B(a,b)} x^{a-1} (1-x)^{b-1}
\end{eqnarray}
</latex>
   </para>
   <para>
if x is in [0,1].
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
// Check with a and b to be expanded
computed = distfun_betapdf ( 0.1:0.2:0.9 , 2 , 3 )
expected = [0.9720,1.7640,1.5000,0.7560,0.1080]
// Check with expanded arguments
x = 0.1:0.2:0.9;
a = [2 3 4 5 6];
b = [5 4 3 2 1];
computed = distfun_betapdf ( x , a, b )
expected = [1.9683,1.8522,1.8750,2.1609,3.54294]
// Check at the bounds
computed = distfun_betapdf ( [1 1 1 1], 1 , 2 )
expected = [0 0 0 0]

// Plot the function
a = [0.5 5 1 2 2];
b = [0.5 1 3 2 5];
cols = [1 2 3 4 5];
nf = size(cols,"*");
lgd = [];
scf();
for k = 1 : nf
x = linspace(0.01,0.99,1000);
y = distfun_betapdf ( x , a(k) , b(k) );
plot(x,y)
str = msprintf("a=%s, b=%s",..
string(a(k)),string(b(k)));
lgd($+1) = str;
end
h = gcf();
for k = 1 : nf
hk = h.children.children.children(nf - k + 1);
hk.foreground = cols(k);
end
xtitle("Beta PDF","x","y");
legend(lgd);
h.children.data_bounds=[0,0;1,3];

   ]]></programlisting>
</refsection>

<refsection>
   <title>Authors</title>
   <simplelist type="vert">
   <member>Copyright (C) 2009-2011 - DIGITEO - Michael Baudin</member>
   <member>Copyright (C) 2012 - Michael Baudin</member>
   </simplelist>
</refsection>
</refentry>
