00001 // @(#)root/mathmore:$Id$ 00002 // Authors: L. Moneta, A. Zsenei 08/2005 00003 00004 00005 00006 /********************************************************************** 00007 * * 00008 * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT * 00009 * * 00010 * This library is free software; you can redistribute it and/or * 00011 * modify it under the terms of the GNU General Public License * 00012 * as published by the Free Software Foundation; either version 2 * 00013 * of the License, or (at your option) any later version. * 00014 * * 00015 * This library is distributed in the hope that it will be useful, * 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00018 * General Public License for more details. * 00019 * * 00020 * You should have received a copy of the GNU General Public License * 00021 * along with this library (see file COPYING); if not, write * 00022 * to the Free Software Foundation, Inc., 59 Temple Place, Suite * 00023 * 330, Boston, MA 02111-1307 USA, or contact the author. * 00024 * * 00025 **********************************************************************/ 00026 00027 00028 #if defined(__CINT__) && !defined(__MAKECINT__) 00029 // avoid to include header file when using CINT 00030 #ifndef _WIN32 00031 #include "../lib/libMathMore.so" 00032 #else 00033 #include "../bin/libMathMore.dll" 00034 #endif 00035 00036 #else 00037 00038 00039 #ifndef ROOT_Math_QuantFuncMathMore 00040 #define ROOT_Math_QuantFuncMathMore 00041 00042 00043 namespace ROOT { 00044 namespace Math { 00045 00046 00047 00048 /** @defgroup QuantFunc Quantile Functions 00049 * @ingroup StatFunc 00050 * 00051 * Inverse functions of the cumulative distribution functions 00052 * and the inverse of the complement of the cumulative distribution functions 00053 * for various distributions. 00054 * The functions with the extension <em>_quantile</em> calculate the 00055 * inverse of the <em>_cdf</em> function, the 00056 * lower tail integral of the probability density function 00057 * \f$D^{-1}(z)\f$ where 00058 * 00059 * \f[ D(x) = \int_{-\infty}^{x} p(x') dx' \f] 00060 * 00061 * while those with the <em>_quantile_c</em> extension calculate the 00062 * inverse of the <em>_cdf_c</em> functions, the upper tail integral of the probability 00063 * density function \f$D^{-1}(z) \f$ where 00064 * 00065 * \f[ D(x) = \int_{x}^{+\infty} p(x') dx' \f] 00066 * 00067 * The implementation used is that of 00068 * <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Random-Number-Distributions.html">GSL</A>. 00069 * 00070 * <strong>NOTE:</strong> In the old releases (< 5.14) the <em>_quantile</em> functions were called 00071 * <em>_quant_inv</em> and the <em>_quantile_c</em> functions were called 00072 * <em>_prob_inv</em>. 00073 * These names are currently kept for backward compatibility, but 00074 * their usage is deprecated. 00075 */ 00076 00077 /** @name Quantile Functions from MathMore 00078 * The implementation used is that of 00079 * <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Random-Number-Distributions.html">GSL</A>. 00080 */ 00081 00082 //@{ 00083 00084 00085 /** 00086 00087 Inverse (\f$D^{-1}(z)\f$) of the cumulative distribution 00088 function of the upper tail of Student's t-distribution 00089 (#tdistribution_cdf_c). For detailed description see 00090 <A HREF="http://mathworld.wolfram.com/Studentst-Distribution.html"> 00091 Mathworld</A>. The implementation used is that of 00092 <A HREF="http://www.gnu.org/software/gsl/manual/gsl-ref_19.html#SEC305">GSL</A>. 00093 00094 @ingroup QuantFunc 00095 00096 */ 00097 00098 double tdistribution_quantile_c(double z, double r); 00099 00100 00101 00102 00103 /** 00104 00105 Inverse (\f$D^{-1}(z)\f$) of the cumulative distribution 00106 function of the lower tail of Student's t-distribution 00107 (#tdistribution_cdf). For detailed description see 00108 <A HREF="http://mathworld.wolfram.com/Studentst-Distribution.html"> 00109 Mathworld</A>. The implementation used is that of 00110 <A HREF="http://www.gnu.org/software/gsl/manual/gsl-ref_19.html#SEC305">GSL</A>. 00111 00112 @ingroup QuantFunc 00113 00114 */ 00115 00116 double tdistribution_quantile(double z, double r); 00117 00118 00119 #ifdef HAVE_OLD_STAT_FUNC 00120 00121 //@} 00122 /** @name Backward compatible functions */ 00123 00124 00125 } 00126 inline double chisquared_quant_inv(double x, double r) { 00127 return chisquared_quantile (x, r ); 00128 } 00129 00130 00131 inline double gamma_quant_inv(double x, double alpha, double theta) { 00132 return gamma_quantile (x, alpha, theta ); 00133 } 00134 00135 inline double tdistribution_prob_inv(double x, double r) { 00136 return tdistribution_quantile_c (x, r ); 00137 } 00138 00139 inline double tdistribution_quant_inv(double x, double r) { 00140 return tdistribution_quantile (x, r ); 00141 } 00142 00143 #endif 00144 00145 00146 } // namespace Math 00147 00148 namespace MathMore { 00149 00150 00151 00152 /** 00153 00154 Re-implementation in MathMore of the Inverse (\f$D^{-1}(z)\f$) of the cumulative distribution 00155 function of the lower tail of the \f$\chi^2\f$ distribution 00156 with \f$r\f$ degrees of freedom (#chisquared_cdf). For detailed description see 00157 <A HREF="http://mathworld.wolfram.com/Chi-SquaredDistribution.html"> 00158 Mathworld</A>. The implementation used is that of 00159 <A HREF="http://www.gnu.org/software/gsl/manual/gsl-ref_19.html#SEC303">GSL</A>. 00160 00161 @ingroup QuantFunc 00162 00163 */ 00164 00165 double chisquared_quantile(double z, double r); 00166 00167 00168 00169 00170 /** 00171 00172 Re-implementation in MathMore of the Inverse (\f$D^{-1}(z)\f$) of the cumulative distribution 00173 function of the lower tail of the gamma distribution 00174 (#gamma_cdf). For detailed description see 00175 <A HREF="http://mathworld.wolfram.com/GammaDistribution.html"> 00176 Mathworld</A>. The implementation used is that of 00177 <A HREF="http://www.gnu.org/software/gsl/manual/gsl-ref_19.html#SEC300">GSL</A>. 00178 00179 @ingroup QuantFunc 00180 00181 */ 00182 00183 double gamma_quantile(double z, double alpha, double theta); 00184 00185 00186 00187 } // end namespace MathMore 00188 } // namespace ROOT 00189 00190 00191 00192 #endif // ROOT_Math_QuantFuncMathMore 00193 00194 #endif // if defined (__CINT__) && !defined(__MAKECINT__)