## artificial data
test2 <- rRenouv(nb = 100,
threshold = 40,
par.N = list(lambda = 2),
densfun.y = "weibull",
par.y = mom2par("weibull", mean = 30, sd = 36))
## exponential exceedances/no historical data/wrong threshold
fit.expon <- fRenouv(x.OT = test2$x,
distname.y = "exponential",
threshold = 50,
conf.pct = c(70, 95, 99),
main = ""exponential" distr. (special)")
## The same but with regarding exponential distribution
## as an arbitrary (not in the listo of special distr.)
fit.exp <- fRenouv(x.OT = test2$x,
distname.y = "exp",
start.par.y = list(rate = 1),
threshold = 50,
main = ""exp" distr. (non-special)")
## The same but with another non-target distribution
## (thus requiering inital values in start.par.y)
fit.gamma <- fRenouv(x.OT = test2$x,
distname.y = "gamma",
threshold = 50,
main = ""gamma" distr. (non-special)")
## Weibull exceedances/no historical data/true threshold
fit.weibull <- fRenouv(x.OT = test2$x,
distname.y = "weibull",
threshold = 50,
main = ""weibull" distr. (special). NO history")
## Add historical data 400 "years"
fit.weibull2 <-
fRenouv(x.OT = test2$x,
z.H = 300, block.H = 1, w.BH = 400, ## HISTORY
distname.y = "weibull",
threshold = 40,
main = ""weibull" distr. (special). History: 1 block of 400 years")
## comparison...
comp <- cbind(c(fit.weibull$est.N, fit.weibull$est.y), fit.weibull2$estimate)
colnames(comp) <- c("No hist.", "With hist.")
print(comp)
## gpd exeedances, like POT, but with history
require(evd)
fit.gpd <-
fRenouv(x.OT = test2$x,
z.H = 300, block.H = 1, w.BH = 400, ## HISTORY
distname.y = "gpd",
threshold = 40,
main = "\"gpd\" distr. (special). History: 1 block of 400 years")
## Coles'book rain example. Blocks are guessed and might not be exact
## due to missing values
library(ismev)
data(rain)
block <- 1:length(rain)
block <- 1914 + floor(block/365)
fit.rain <- fRenouv(x.OT = rain,
distname.y = "gpd",
threshold = 30,
main = "\"gpd\" distr. (target) on ismev 'rain' dataset")
fit.rain.evd <- fpot(x = rain, threshold = 30, model ="gpd")Run the code above in your browser using DataLab