Density.h

Go to the documentation of this file.
00001 ///
00002 /// \file   Density.h
00003 /// \brief  Collects a variety of constants and function in namespace Util.
00004 ///
00005 /// Provides definitions for a variety of functions related to numerical
00006 /// evaluation of probability densities.
00007 ///
00008 /// All are declared in namespace Density with an eye towards avoiding
00009 /// naming conflicts.
00010 ///
00011 /// \author Kent Holsinger
00012 /// \date   2004-07-03
00013 ///
00014 
00015 // This file is part of MCMC++, a library for constructing C++ programs
00016 // that implement MCMC analyses of Bayesian statistical models.
00017 // Copyright (c) 2004-2006 Kent E. Holsinger
00018 //
00019 // MCMC++ is free software; you can redistribute it and/or modify
00020 // it under the terms of the GNU General Public License as published by
00021 // the Free Software Foundation; either version 2 of the License, or
00022 // (at your option) any later version.
00023 //
00024 // MCMC++ is distributed in the hope that it will be useful,
00025 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00027 // GNU General Public License for more details.
00028 //
00029 // You should have received a copy of the GNU General Public License
00030 // along with MCMC++; if not, write to the Free Software
00031 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00032 //
00033 
00034 #if !defined(__DENSITY_H)
00035 #define __DENSITY_H
00036 
00037 // standard includes
00038 #include <vector>
00039 
00040 /// \namespace Density
00041 ///
00042 /// Used to isolate functions for density evaluation.
00043 ///
00044 /// Provides a variety of numerical density routines. All of them are
00045 /// derived from R. Details are provided in the comments accompanying each
00046 /// one.
00047 ///
00048 namespace Density {
00049 
00050   /// Minimum value of parameters to be used in gamln()
00051   ///
00052   extern const double MinGammaPar;
00053   /// Maximum value of parameters to be used in gamln()
00054   ///
00055   extern const double MaxGammaPar;
00056 
00057   double dbeta(double x, double a, double b,
00058                bool give_log = false);
00059   // probability of choosing k from n, with probability p on each choice
00060   // (sampling with replacement)
00061   double dbinom(int k, int n, double p, bool give_log);
00062   double dcauchy(double x, double l, double s, bool give_log); 
00063   double dchisq(double x, double n, bool give_log);
00064   double ddirch(const std::vector<double>& p, const std::vector<double>& a,
00065                 const bool give_log = false, const bool include_const = true);
00066   double dexp(double x, double b, bool give_log);
00067   double df(double x, double m, double n, bool give_log);
00068   double dgeom(unsigned x, double p, bool give_log);
00069   double dgamma(double x, double shape, double scale, bool give_log);
00070   double dhyper(unsigned x, unsigned r, unsigned b, unsigned n, bool giveLog);
00071   double dinvgamma(double y, double shape, double scale, bool give_log);
00072   double dlnorm(double x, double mu, double sigma, bool give_log);
00073   double dlogis(double x, double m, double s, bool give_log);
00074   double dmulti(const std::vector<int>& n, const std::vector<double>& p,
00075                 bool give_log = false, bool include_factorial = false);
00076   double dnbinom(unsigned x, double n, double p, bool give_log);
00077   double dnorm(double x_in, double mu, double sigma, bool give_log);
00078   double dpois(unsigned x, double lambda, bool give_log);
00079   double dt(double x, double n, bool give_log);
00080   double dweibull(double x, double a, double b, bool give_log);
00081   double BetaEntropy(double a, double b);
00082   double logChoose(double n, double k);
00083   double gamln(double x);
00084   double lbeta(double a, double b);
00085  
00086 }
00087 
00088 #endif
00089 
00090 // Local Variables: //
00091 // mode: c++ //
00092 // End: //
00093 

Generated on Tue Mar 27 16:03:38 2007 for mcmc by  doxygen 1.5.1