I need to sample from the generalized beta of the second kind (GB2) distribution (McDonald, 1984, Econometrica). Its PDF has the form $$ f_{a,b,p,q}(x) = \frac{|a|x^{ap-1}}{b^{ap}B(p,q)(1+(x/b)^a)^{p+q}}. $$ Its CDF does not have a closed form, so I cannot use an inverse transform method. Does anyone know how to sample from this distribution or know of a Fortran random number generator library that contains this distribution?

None of the packages in the netlib.org/random library contain the GB2.

  • $\begingroup$ I looked up GB2 on wikipedia and put the PDF directly into the question to make it easier to read. Can you please check that this is the right distribution and the right expression? $\endgroup$
    – Kirill
    Nov 15, 2014 at 11:41
  • $\begingroup$ If the inverse transform method is inapplicable, you can try to use the acceptance-rejection method. How efficient it would be, though, depends on what proposal distribution you choose. $\endgroup$
    – Kirill
    Nov 15, 2014 at 11:50
  • $\begingroup$ This is the correct distribution and expression. Thanks for clarifying. $\endgroup$
    – uncecon
    Nov 17, 2014 at 21:06

1 Answer 1


If you're interested in the distribution for fixed values of $a,b,p,q$, you can compute and tabulate the cumulative distribution by quadrature. Since it's only a 1d function for fixed parameters, you can compute the cumulative function for fixed values of $x$ with pretty high accuracy, connect these points by a polynomial approximation, and then use this surrogate function for sampling.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.