cdfgno: Generalized normal distribution

Description Usage Arguments Details Value Note See Also Examples

View source: R/lmom.r

Description

Distribution function and quantile function of the generalized normal distribution.

Usage

1
2
cdfgno(x, para = c(0, 1, 0))
quagno(f, para = c(0, 1, 0))

Arguments

x

Vector of quantiles.

f

Vector of probabilities.

para

Numeric vector containing the parameters of the distribution, in the order xi, alpha, k (location, scale, shape).

Details

The generalized normal distribution with location parameter xi, scale parameter alpha and shape parameter k has distribution function

F(x) = Phi(y)

where

y = (-1/k) log(1-k(x-xi)/alpha)

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.

Value

cdfgno gives the distribution function; quagno gives the quantile function.

Note

The functions expect the distribution parameters in a vector, rather than as separate arguments as in the standard R distribution functions pnorm, qnorm, etc.

See Also

cdfln3 for the lmom package's version of the three-parameter lognormal distribution.

cdfnor for the lmom package's version of the normal distribution.

pnorm for the standard R version of the normal distribution.

plnorm for the standard R version of the two-parameter lognormal distribution.

Examples

1
2
3
4
5
6
7
8
# Random sample from the generalized normal distribution
# with parameters xi=0, alpha=1, k=-0.5.
quagno(runif(100), c(0,1,-0.5))

# 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)))

Example output

  [1]  0.66489425  2.22464582  0.83324715 -0.42208096 -0.60579855 -0.05481122
  [7]  1.23479186 -0.53030545  1.02767900  0.59569741  0.07662241  0.97644076
 [13]  1.51912561  2.35676280  1.13015268 -0.08144780 -0.19763871 -0.73313117
 [19] -1.43206605  1.82079041  0.68971898  0.41114401  0.51036054 -0.95738900
 [25] -0.48584298 -0.51532116 -1.12804618 -1.11533548  0.95205344 -0.42049044
 [31]  0.57457530  0.83544673  0.36545589  0.03829873  0.70179971 -0.07072768
 [37] -1.58889222  0.47255932 -0.32302737 -0.02710980  1.57251493  0.67052542
 [43]  2.68286480  1.54490035 -0.24910429 -0.03013135  0.70546152 -0.67746946
 [49] -0.29338966 -0.13528865 -0.05599837 -0.23522823 -0.10704833  0.45119126
 [55]  3.47282460  0.15543564  2.87673617 -0.89896593  1.31522859 -0.04366892
 [61] -0.37381755 -1.08078015  0.03207914  0.72884401 -0.36872442  0.23854964
 [67] -0.26773807 -0.73024975 -0.50239245  1.06078307  3.37790926  0.76027218
 [73]  0.26327258 -0.53215609 -0.09550550  0.34546796  0.17971531  0.01952761
 [79]  0.40171757 -1.38155277 -1.25099267 -0.91935047  0.19255949  0.19925502
 [85]  3.02479645 -0.75020585  1.36643501  1.42466129 -0.80777745  0.28780178
 [91] -0.11390012 -0.23685741  0.51567933  3.22512345 -0.49854253 -0.47612197
 [97] -1.02235466  1.07610761 -0.31813273  0.00587901
      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

lmom documentation built on Aug. 2, 2017, 9:03 a.m.