1%feature("docstring") OT::NegativeBinomial 2"NegativeBinomial distribution. 3 4Available constructors: 5 NegativeBinomial(*r=1.0, p=0.5*) 6 7Parameters 8---------- 9r : float, :math:`r > 0` 10 Number of failures until the Bernoulli trial is stopped. 11 12p : float, :math:`0 < p < 1` 13 Success probability of the Bernoulli trial. 14 15Notes 16----- 17Its probability density function is defined as: 18 19.. math:: 20 21 \Prob{X = k} = \frac{\Gamma(k + r)}{\Gamma(r)\Gamma(k+1)}p^k(1-p)^r, 22 \, \forall k \in \Nset 23 24Its first moments are: 25 26.. math:: 27 :nowrap: 28 29 \begin{eqnarray*} 30 \Expect{X} & = & \frac{rp}{1-p} \\ 31 \Var{X} & = & \frac{rp}{(1-p)^2} 32 \end{eqnarray*} 33 34Examples 35-------- 36Create a distribution: 37 38>>> import openturns as ot 39>>> distribution = ot.NegativeBinomial(1.0, 0.6) 40 41Draw a sample: 42 43>>> sample = distribution.getSample(5)" 44 45// --------------------------------------------------------------------- 46 47%feature("docstring") OT::NegativeBinomial::getP 48"Accessor to the success probability parameter. 49 50Returns 51------- 52p : float 53 The success probability of the Bernoulli trial." 54 55// --------------------------------------------------------------------- 56 57%feature("docstring") OT::NegativeBinomial::getR 58"Accessor to the number of failures parameter. 59 60Returns 61------- 62r : float 63 Number of failures until the Bernoulli trial is stopped." 64 65// --------------------------------------------------------------------- 66 67%feature("docstring") OT::NegativeBinomial::setP 68"Accessor to the success probability parameter. 69 70Parameters 71---------- 72p : float, :math:`0 \leq p \leq 1` 73 The success probability of the Bernoulli trial." 74 75// --------------------------------------------------------------------- 76 77%feature("docstring") OT::NegativeBinomial::setR 78"Accessor to the number of failures parameter. 79 80Parameters 81---------- 82r : float, :math:`r > 0` 83 Number of failures until the Bernoulli trial is stopped." 84