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

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

<refentry version="5.0-subset Scilab" xml:id="distfun_geornd" 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_geornd</refname>
    <refpurpose>Geometric random numbers</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Calling Sequence</title>
   <synopsis>
   x = distfun_geornd(pr)
   x = distfun_geornd(pr,[m,n])
   x = distfun_geornd(pr,m,n)
   
   </synopsis>
</refsynopsisdiv>

<refsection>
   <title>Parameters</title>
   <variablelist>
   <varlistentry><term>pr :</term>
      <listitem><para> a matrix of doubles, the probability of getting success in a Bernoulli trial. pr in (0,1].</para></listitem></varlistentry>
   <varlistentry><term>m :</term>
      <listitem><para> a 1-by-1 matrix of floating point integers, the number of rows of x</para></listitem></varlistentry>
   <varlistentry><term>n :</term>
      <listitem><para> a 1-by-1 matrix of floating point integers, the number of columns of x</para></listitem></varlistentry>
   <varlistentry><term>x:</term>
      <listitem><para> a matrix of doubles, the random numbers in the set {0,1,2,3,...}.</para></listitem></varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Description</title>
   <para>
Generates random variables from the Geometric 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>
Note - The output argument x belongs to the set {0,1,2,3,...}.
This is not compatible with the <literal>grand(m,n,"geom",p)</literal> function in Scilab v5,
where the choice is the set {1,2,3,...}.
In other words, the calling sequence
   </para>
   <para>
<screen>
x = grand(m,n,"geom",pr)
</screen>
   </para>
   <para>
is equivalent to
   </para>
   <para>
<screen>
x = distfun_geornd(pr,m,n) + 1
</screen>
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
// Test with expanded pr
x = distfun_geornd(1 ./(1:6))

// Check expansion of pr in x = distfun_geornd(pr)
N = 10;
x = distfun_geornd(1 ./(1:6))

// Check x = distfun_geornd(pr,v)
x = distfun_geornd(0.2,[4 5])

// Check mean and variance
N = 5000;
pr = 0.3;
x = distfun_geornd(pr,[1 N]);
RM = mean(x)
RV = variance(x)
[M,V] = distfun_geostat(pr)

// Check actual distribution
h=scf();
pr=0.7;
N=10000;
x=distfun_geornd(pr,1,N);
Rmax=max(x);
distfun_inthisto(x);
h.children.children(1).children.background=-2;
M=distfun_geostat(pr);
x=0:Rmax;
y=distfun_geopdf(x,pr);
plot(x,y,"ro-");
xtitle("Geometric Random Numbers","X","Density")
legend(["Empirical","Density"]);

   ]]></programlisting>
</refsection>

<refsection>
   <title>Bibliography</title>
   <para>http://en.wikipedia.org/wiki/Geometric_distribution</para>
</refsection>

<refsection>
   <title>Authors</title>
   <simplelist type="vert">
   <member>Copyright (C) 2012 - 2014 - Michael Baudin</member>
   <member>Copyright (C) 2012 - Prateek Papriwal</member>
   </simplelist>
</refsection>
</refentry>
