R/rgpd.r

rgpd <- function(n, gam, sigma = 1){
#
# Random number generation for the generalized Pareto
# distribution (GPD).
#
# Input:
# - n     : Number of random numbers to be generated.
# - gam   : tail index
# - sigma : scale parameter
#
# Kaspar Rufibach, 2006
#
u <- runif(n,0,1)
r <- qgpd(u, gam, sigma)

err <- 0
if (n<=0){
    err <- 1
    cat('Please give a strict positive n!')}

if (err==0){return(sort(r))}
}

Try the smoothtail package in your browser

Any scripts or data that you put into this service are public.

smoothtail documentation built on May 2, 2019, 5:41 a.m.