cdfgno.RdDistribution function and quantile function of the generalized normal distribution.
The generalized normal distribution with location parameter \(\xi\), scale parameter \(\alpha\) and shape parameter \(k\) has distribution function $$F(x)=\Phi(y)$$ where $$y=-k^{-1}\log\lbrace1-k(x-\xi)/\alpha\rbrace$$ and \(\Phi(y)\) is the distribution function of the standard normal distribution, with \(x\) bounded by \(\xi+\alpha/k\) from below if \(k<0\) and from above if \(k>0\).
The generalized normal distribution contains as special cases the usual three-parameter lognormal distribution, corresponding to \(k<0\), with a finite lower bound and positive skewness; the normal distribution, corresponding to \(k=0\); and the reverse lognormal distribution, corresponding to \(k>0\), with a finite upper bound and negative skewness. The two-parameter lognormal distribution, with a lower bound of zero and positive skewness, is obtained when \(k<0\) and \(\xi+\alpha/k=0\).
cdfgno gives the distribution function;
quagno gives the quantile function.
The functions expect the distribution parameters in a vector,
rather than as separate arguments as in the standard R
distribution functions pnorm, qnorm, etc.
# Random sample from the generalized normal distribution
# with parameters xi=0, alpha=1, k=-0.5.
quagno(runif(100), c(0,1,-0.5))
#> [1] 0.066570567 1.316817902 -0.845239758 -0.291251711 -0.542739806
#> [6] -0.005374598 -1.287289513 -0.985905824 5.520351667 2.391237019
#> [11] -0.876500929 -0.902038695 -0.313208440 -0.071351861 0.963373936
#> [16] -0.023939546 -0.940400913 2.416713766 0.622735762 0.005683691
#> [21] 0.076533952 -0.553647407 0.644294729 3.065631221 0.461695602
#> [26] 1.026172965 -1.032464070 1.642480174 1.201918737 0.699786795
#> [31] -0.311772357 0.059631832 -0.074164197 -0.950550846 0.040611207
#> [36] -0.122426502 0.128245035 0.423326038 -0.785987607 -0.475117850
#> [41] 1.705588991 0.235466222 0.371112914 -0.551225566 -0.420993363
#> [46] -0.374367387 0.850583521 -1.365075927 -1.068847469 -0.541550066
#> [51] 0.252092665 -0.466685674 -0.962576691 0.852855549 0.905662659
#> [56] -0.233415707 -1.084341717 0.803257651 0.072330583 -0.514913974
#> [61] -0.547364062 0.113176769 -0.689315776 0.408848394 0.803222178
#> [66] -0.525648807 1.560265307 1.370687193 -1.139382560 -0.280911781
#> [71] -0.726537334 2.062456343 1.865009056 -0.703592929 1.466834972
#> [76] -1.340269222 1.651109535 -0.257194499 -1.022237234 0.414445647
#> [81] 1.993238678 1.251821550 0.003128391 0.276407259 -0.076389746
#> [86] 1.657872702 0.493933770 -0.252119342 0.133168922 -0.589430133
#> [91] -0.679460911 -1.049703079 -0.445194085 4.853995511 -0.898881385
#> [96] 0.658590878 -0.626605352 -0.852257800 2.141540685 1.734166733
# The generalized normal distribution with parameters xi=1, alpha=1, k=-1,
# is the standard lognormal distribution. An illustration:
fval<-seq(0.1,0.9,by=0.1)
cbind(fval, lognormal=qlnorm(fval), g.normal=quagno(fval, c(1,1,-1)))
#> fval lognormal g.normal
#> [1,] 0.1 0.2776062 0.2776062
#> [2,] 0.2 0.4310112 0.4310112
#> [3,] 0.3 0.5919101 0.5919101
#> [4,] 0.4 0.7761984 0.7761984
#> [5,] 0.5 1.0000000 1.0000000
#> [6,] 0.6 1.2883304 1.2883304
#> [7,] 0.7 1.6894457 1.6894457
#> [8,] 0.8 2.3201254 2.3201254
#> [9,] 0.9 3.6022245 3.6022245