<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="_binomial_8cpp">
<title>/Users/bernard/b20/bsoft/src/util/binomial.cpp File Reference</title>
<indexterm><primary>/Users/bernard/b20/bsoft/src/util/binomial.cpp</primary></indexterm>
<para>

<para>Functions to generate and fit binomials. </para>
 
</para>
<programlisting>#include &quot;simplex.h&quot;
#include &quot;math_util.h&quot;
#include &quot;utilities.h&quot;
</programlisting><simplesect>
    <title>Functions    </title>
        <itemizedlist>
            <listitem><para>double <link linkend="_binomial_8cpp_1a3b08f0138ee6ceb9fdcc7d990969be4c">Bnp_R</link> (<link linkend="_class_bsimplex">Bsimplex</link> *simp)</para>
</listitem>
            <listitem><para>double <link linkend="_binomial_8cpp_1a0111826b664d630ba7e6511f813879c4">Bnpk</link> (int n, double p, int k, double w)</para>

<para>Calculates the probability of k occurrences in n cases. </para>
</listitem>
            <listitem><para>double <link linkend="_binomial_8cpp_1a50d1f8d201e135cc9da65e957f3813de">Bnp_R</link> (<link linkend="_class_bsimplex">Bsimplex</link> &amp;simp)</para>
</listitem>
            <listitem><para>double <link linkend="_binomial_8cpp_1ac3ebb02ab017177946b397ef189872d0">binomial_fit</link> (vector&lt; double &gt; &amp;distrib, int n, int nfit, vector&lt; double &gt; &amp;coeff)</para>

<para>Fits a distribution to one or more binomial distributions. </para>
</listitem>
        </itemizedlist>
</simplesect>
<simplesect>
    <title>Variables    </title>
        <itemizedlist>
            <listitem><para>int <link linkend="_binomial_8cpp_1a0b2caeb4b6f130be43e5a2f0267dd453">verbose</link></para>
</listitem>
        </itemizedlist>
</simplesect>
<section>
<title>Detailed Description</title>

<para>Functions to generate and fit binomials. </para>

<para><formalpara><title>Author: </title>

<para>Daniel Nemecek and Bernard Heymann </para>
</formalpara>
<formalpara><title>Date: </title>

<para>Created: 20091202 </para>

<para>Modified: 20190201 </para>
</formalpara>
</para>
</section>
<section>
<title>Function Documentation</title>
<anchor xml:id="_binomial_8cpp_1ac3ebb02ab017177946b397ef189872d0"/>    <section>
    <title>binomial_fit()</title>
<indexterm><primary>binomial_fit</primary><secondary>binomial.cpp</secondary></indexterm>
<indexterm><primary>binomial.cpp</primary><secondary>binomial_fit</secondary></indexterm>
<para><computeroutput>double binomial_fit (vector&lt; double &gt; &amp; distrib, int n, int nfit, vector&lt; double &gt; &amp; coeff)</computeroutput></para><para>

<para>Fits a distribution to one or more binomial distributions. </para>
</para>

<para><formalpara><title>Author: </title>

<para>Daniel Nemecek and Bernard Heymann </para>
</formalpara>

                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>&amp;distrib</entry>
                                <entry>
<para>distribution. </para>
</entry>
                            </row>
                            <row>
                                <entry>n</entry>
                                <entry>
<para>number of cases (number of values in distribution). </para>
</entry>
                            </row>
                            <row>
                                <entry>nfit</entry>
                                <entry>
<para>number of binomial curves to fit. </para>
</entry>
                            </row>
                            <row>
                                <entry>&amp;coeff</entry>
                                <entry>
<para>fitted coefficients (weights and probabilities). </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>double residual. <literallayout><computeroutput>The binomial curve(s) is(are) fit using the downhill simplex method.
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 89 of file binomial.cpp.</para>
    </section><anchor xml:id="_binomial_8cpp_1a3b08f0138ee6ceb9fdcc7d990969be4c"/>    <section>
    <title>Bnp_R()<computeroutput>[1/2]</computeroutput></title>
<indexterm><primary>Bnp_R</primary><secondary>binomial.cpp</secondary></indexterm>
<indexterm><primary>binomial.cpp</primary><secondary>Bnp_R</secondary></indexterm>
<para><computeroutput>double Bnp_R (<link linkend="_class_bsimplex">Bsimplex</link> * simp)</computeroutput></para>    </section><anchor xml:id="_binomial_8cpp_1a50d1f8d201e135cc9da65e957f3813de"/>    <section>
    <title>Bnp_R()<computeroutput>[2/2]</computeroutput></title>
<indexterm><primary>Bnp_R</primary><secondary>binomial.cpp</secondary></indexterm>
<indexterm><primary>binomial.cpp</primary><secondary>Bnp_R</secondary></indexterm>
<para><computeroutput>double Bnp_R (<link linkend="_class_bsimplex">Bsimplex</link> &amp; simp)</computeroutput></para><para>
Definition at line 43 of file binomial.cpp.</para>
    </section><anchor xml:id="_binomial_8cpp_1a0111826b664d630ba7e6511f813879c4"/>    <section>
    <title>Bnpk()</title>
<indexterm><primary>Bnpk</primary><secondary>binomial.cpp</secondary></indexterm>
<indexterm><primary>binomial.cpp</primary><secondary>Bnpk</secondary></indexterm>
<para><computeroutput>double Bnpk (int n, double p, int k, double w)</computeroutput></para><para>

<para>Calculates the probability of k occurrences in n cases. </para>
</para>

<para><formalpara><title>Author: </title>

<para>Daniel Nemecek and Bernard Heymann </para>
</formalpara>

                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>n</entry>
                                <entry>
<para>number of cases. </para>
</entry>
                            </row>
                            <row>
                                <entry>p</entry>
                                <entry>
<para>probability of one occurrence [0-1]. </para>
</entry>
                            </row>
                            <row>
                                <entry>k</entry>
                                <entry>
<para>occurrences (&lt;=n). </para>
</entry>
                            </row>
                            <row>
                                <entry>w</entry>
                                <entry>
<para>weight [0-1]. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>double weighted probability. </para>
</formalpara>
</para>
<para>
Definition at line 28 of file binomial.cpp.</para>
</section>
</section>
<section>
<title>Variable Documentation</title>
<anchor xml:id="_binomial_8cpp_1a0b2caeb4b6f130be43e5a2f0267dd453"/>    <section>
    <title>verbose</title>
<indexterm><primary>verbose</primary><secondary>binomial.cpp</secondary></indexterm>
<indexterm><primary>binomial.cpp</primary><secondary>verbose</secondary></indexterm>
<para><computeroutput>int verbose</computeroutput></para></section>
</section>
</section>
