src/main/cpp/numerics4cpp/statistics/distribution/negativebinomial.h

00001 /*
00002  * Copyright (c) 2007, DoodleProject
00003  * All rights reserved.
00004  * 
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 
00009  * Redistributions of source code must retain the above copyright
00010  * notice, this list of conditions and the following disclaimer.
00011  * 
00012  * Redistributions in binary form must reproduce the above copyright
00013  * notice, this list of conditions and the following disclaimer in
00014  * the documentation and/or other materials provided with the
00015  * distribution.
00016  * 
00017  * Neither the name of DoodleProject nor the names of its contributors
00018  * may be used to endorse or promote products derived from this
00019  * software without specific prior written permission.
00020  * 
00021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
00022  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
00023  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00024  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00025  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
00026  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00027  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00028  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00029  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00030  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
00031  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00032  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033  * SUCH DAMAGE.
00034  */
00035 
00036 #ifndef _NUMERICS4CPP_STATISTICS_DISTRIBUTION_NEGATIVEBINOMIAL_H_
00037 #define _NUMERICS4CPP_STATISTICS_DISTRIBUTION_NEGATIVEBINOMIAL_H_
00038 
00039 #include "discrete.h"
00040 
00041 NUM_NAMESPACE_BEGIN
00042 
00060 class negative_binomial_distribution : public discrete_distribution {
00061 
00062 public:
00069         negative_binomial_distribution(int r = 1, double p = 0.5);
00070 
00076         double cdf(int x) const;
00077         
00084         int inverse_cdf(double p) const;
00085 
00091         double pmf(int x) const;
00092 
00097         int number_of_successes() const;
00098         
00103         void number_of_successes(int n);
00104         
00109         double probability_of_success() const;
00110         
00115         void probability_of_success(double p);
00116                         
00117 private:
00119         int _number_of_successes;
00120         
00122         double _probability_of_success;
00123 };
00124 
00125 NUM_NAMESPACE_END
00126 
00127 #endif

Generated on Wed Nov 21 22:22:15 2007 for numerics4c++ by  doxygen 1.5.3