gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
A better way of generating pareto distr, and swap its parameters. - Pareto distribution is now generated as a composition of a Gamma and an exponential one - Similarly to gamma() and weibull(), the shape parameter became the first one.
0 1 0
default
1 file changed with 3 insertions and 7 deletions:
↑ Collapse diff ↑
Ignore white space 8 line context
... ...
@@ -797,18 +797,14 @@
797 797
    /// Pareto distribution
798 798

	
799 799
    /// This function generates a Pareto distribution random number.
800 800
    /// 
801
    ///\param k shape parameter (<tt>k>0</tt>)
801 802
    ///\param x_min location parameter (<tt>x_min>0</tt>)
802
    ///\param k shape parameter (<tt>k>0</tt>)
803 803
    ///
804
    ///\warning This function used inverse transform sampling, therefore may
805
    ///suffer from numerical unstability.
806
    ///
807
    ///\todo Implement a numerically stable method
808
    double pareto(double x_min,double k)
804
    double pareto(double k,double x_min)
809 805
    {
810
      return x_min*pow(1.0-real<double>(),1.0/k);
806
      return exponential(gamma(k,1.0/x_min));
811 807
    }  
812 808
      
813 809
    ///@}
814 810
    
0 comments (0 inline)