finding quantile of the generalized normal distribution

Viewed 111

I am writing a Matlab code for finding quantile of the generalized normal distribution

x ~ GN(0, alfa, beta) :
p(x; 0, alfa, beta) = (beta/(2*alfa*gamma(1/beta))) * exp(-(abs(x)/alfa).^beta )

According to quantile formula shown in https://en.wikipedia.org/wiki/Generalized_normal_distribution , for quantile C, I calculated quantile by

z_c = sign(C-0.5).*gaminv(2*abs(C-0.5), 1./beta, 1./(alfa.^beta)).^(1./beta)+0

To validate the equation above, I assigned alfa=sqrt(2) and beta=2 to make the generalized normal to be a normal distribution. But when I calculated

>> C=0.05; beta =2; alfa =sqrt(2);
>> z_c = sign(C-0.5).*gaminv(2*abs(C-0.5), 1./beta, 1./(alfa.^beta)).^(1./beta)
z_c =
   -0.8224

I thought the result should be exactly the same as the quantile of the inverse of the normal CDF with mean mu=0 and standard deviation sigma=1, however,

>> norminv(C)
ans =
   -1.6449

Could anyone help to point out the mistake(s) made above?

0 Answers
Related