STK++ 0.9.13
STK_Law_Binomial.cpp
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff, Université Lille 1, Inria
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this program; if not, write to the
16 Free Software Foundation, Inc.,
17 59 Temple Place,
18 Suite 330,
19 Boston, MA 02111-1307
20 USA
21
22 Contact : S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
23 */
24
25/*
26 * Project: stkpp::STatistiK::Law
27 * created on: 23 janv. 2013
28 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 **/
30
35#ifndef IS_RTKPP_LIB
36#include "../include/STK_Law_Binomial.h"
38#endif
39
40
41namespace STK
42{
43
44namespace Law
45{
46
47#ifndef IS_RTKPP_LIB
48
49int Binomial::rand() const
50{
51 return 0;
52}
53
54Real Binomial::pdf(int const& x) const
55{
56 // trivial cases
58 // compute result
60}
61
62Real Binomial::lpdf(int const& x) const
63{
64 // trivial cases
66 // compute result
68}
69Real Binomial::cdf(Real const& t) const
70{
71 // trivial cases
73 return 0.;
74}
75
76int Binomial::icdf(Real const& p) const
77{
78 // trivial cases
80 return 0.;
81}
82
83int Binomial::rand(int n, Real const& prob)
84{
85 return 0;
86}
87
88Real Binomial::pdf(int x, int n, Real const& prob)
89{
90 // trivial cases
92 // compute result
93 return Funct::binomial_pdf_raw(x, n, prob);
94}
95
96Real Binomial::lpdf(int x, int n, Real const& prob)
97{
98 // trivial cases
100 // compute result
101 return Funct::binomial_lpdf_raw(x, n, prob);
102}
103Real Binomial::cdf(Real const& t, int n, Real const& prob)
104{
105 return 0.;
106}
107
108int Binomial::icdf(Real const& p, int n, Real const& prob)
109{
110 return 0.;
111}
112
113#endif
114
115} // namespace Law
116
117} // namespace STK
118
In this file we declare raw the functions.
virtual Integer icdf(Real const &p) const
inverse cumulative distribution function The quantile is defined as the smallest value x such that F...
Real const & prob() const
virtual Real cdf(Real const &t) const
compute the cumulative distribution function Give the probability that a Binomial random variate is l...
virtual Integer rand() const
virtual Real lpdf(Integer const &x) const
compute the log probability distribution function Give the value of the log-pdf at the point x.
virtual Real pdf(Integer const &x) const
compute the probability distribution function (density) Give the value of the pdf at the point x.
Real prob_
probability of success in a Bernoulli trial
int n_
number of trials
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Real binomial_pdf_raw(Real const &x, Real const &n, Real const &p)
Compute the generalized binomial probability mass function.
Real binomial_lpdf_raw(Real const &x, Real const &n, Real const &p)
Compute the generalized binomial log-probability mass function.
double Real
STK fundamental type of Real values.
The namespace STK is the main domain space of the Statistical ToolKit project.
Arithmetic properties of STK fundamental types.
static Type NA()
Adding a Non Available (NA) special number.