StructEst_W20
StructEst_W20 copied to clipboard
Moving to GB2 Distribution
I'm sorry if this is a stupid question but when moving to the GB2 Distribution do we use our 'm' estimate directly as 'p' or is there some conversion that needs to take place?
@davefoote . Good question. The progression is the following, which is also explained in Section 7 of the maximum likelihood notebook:
- Estimate the
GA(x|alpha,beta)
using initial guesses ofbeta_init=Var(x)/E(x)
andalpha_init=E(x)/beta_init
. - Because the
GA(x|alpha,beta)
distribution is a nested case of theGG(x|alpha,beta,m)
distribution such thatGA(x|alpha,beta)=GG(x|alpha,beta,m=1)
, estimate theGG(x|alpha,beta,m)
distribution using initial guessesalpha_hat
andbeta_hat
from step (1) estimates of theGA
distribution and initial guessm_init=1
. - Because the
GG(x|alpha,beta,m)
distribution is a nested case of theGB2(x|a,b,p,q)
distribution such thatGG(x|alpha,beta,m)=GB2(x|a=m,b=q**(1/m),p=alpha/m,q)
, estimate theGB2(x|a,b,p,q)
distribution using initial guessesa_init=m_hat
,p_init=alpha_hat/m_hat
from step (2) andb_init
andq_init
using largeq
likeq=1000
. This approximates infinity.
@davefoote . Here is some good GB2 code.
import numpy as np
import scipy.special as spc
def GB2_pdf(xvals, aa, bb, pp, qq):
'''
--------------------------------------------------------------------
Returns the PDF values from the four-parameter generalized beta 2
(GB2) distribution. See McDonald and Xu (1995).
(GB2): f(x; a, b, p, q) = (a * (x ** ((a*p) - 1))) /
((b ** (a * p)) * spc.beta(p, q) *
((1 + ((x / b) ** a)) ** (p + q)))
x in [0, infty), alpha, beta, m > 0
--------------------------------------------------------------------
INPUTS:
xvals = (N,) vector, values in the support of generalized beta 2
(GB2) distribution
aa = scalar > 0, generalized beta 2 (GB2) distribution parameter
bb = scalar > 0, generalized beta 2 (GB2) distribution parameter
pp = scalar > 0, generalized beta 2 (GB2) distribution parameter
qq = scalar > 0, generalized beta 2 (GB2) distribution parameter
OTHER FUNCTIONS AND FILES CALLED BY THIS FUNCTION:
spc.beta()
OBJECTS CREATED WITHIN FUNCTION:
pdf_vals = (N,) vector, pdf values from generalized beta 2 (GB2)
distribution corresponding to xvals given parameters aa,
bb, pp, and qq
FILES CREATED BY THIS FUNCTION: None
RETURNS: pdf_vals
--------------------------------------------------------------------
'''
pdf_vals = \
np.float64((aa * (xvals ** (aa * pp - 1))) / ((bb ** (aa * pp)) *
spc.beta(pp, qq) *
((1 + ((xvals / bb) ** aa)) ** (pp + qq))))
return pdf_vals