Learn R Programming

Renext (version 2.1-0)

rRenouv: Simulation of "Renouvellement" data

Description

Simulation of "Renouvellement" data, i.e. observations Over a Threshold and their counts on blocks (e.g. years).

Usage

rRenouv(densfun.y = "exponential",
            par.y = list(rate = 1),
            densfun.N = "poisson",
            par.N = list(lambda = 6),
            threshold = 0,
            aggreg = TRUE,
            nb = 50,
            labb = seq(to = 2009, by = 1, length = nb),
            w = rep(1, nb))

Arguments

densfun.y
A character string specifying the distribution of the exceedances over the threshold. At the time only "exponential", "weibull" and "gpd" are available.
par.y
Named list giving parameter values for the "y"-distribution. See examples below.
densfun.N
Character string specifying the distribution for the counts. At the time only "poisson" and "negative binomial" are allowed.
par.N
Named list giving parameter values for the N-distribution for counts. The names are lambda in the Poisson case ("poisson"), and size and prob in the negative binomial case (
threshold
Threshold value.
aggreg
Only TRUE is possible at the time.
nb
Number of blocks (or time intervals).
labb
Numeric vector of length nb that will be used in replacement of the block numbers vector. Typically it can contain year numbers. Use NULL to obtain blocks from 1 to nb.
w
Vector of blocks (time interval) length, i.e. duration.

Value

  • A list with the following objects
  • xVector of x values i.e. threshold plus exceedances.
  • NVector of counts.
  • blockVector of length length(x) giving the block number for the corresponding element in x. When coerced to a factor block has length(N) levels.

See Also

Renouv to fit Renouvellement models.

Examples

Run this code
test1 <- rRenouv(nb = 100,
                threshold = 40,
                par.N = list(lambda = 2),
                densfun.y = "gpd",
                par.y = mom2par("gpd", mean = 30, sd = 36))

test2 <- rRenouv(nb = 100,
                threshold = 40,
                par.N = list(lambda = 2),
                densfun.y = "weibull",
                par.y = mom2par("weibull", mean = 30, sd = 36))

test3 <- rRenouv(nb = 100,
                threshold = 40,
                densfun.N = "negative binomial",
                par.N = list(gamma = 10, prob = 0.7),
                densfun.y = "weibull",
                par.y = mom2par("weibull", mean = 30, sd = 36))

Run the code above in your browser using DataLab