# Example Bayesian estimation,
# Threshold exceedances approach, threshold set by default
# Joint estimation margins + dependence
# Default uniform prior on pm
# Default negative binomial prior on polynomial order
# Quadratic relationship between location and max temperature
if (FALSE) {
data(MilanPollution)
data <- Milan.winter[,c("NO2", "SO2", "MaxTemp")]
data <- data[complete.cases(data),]
covar <- cbind(rep(1,nrow(data)), data[,3], data[,3]^2)
hyperparam <- list(mu.binom=6, var.binom=8, a.unif=0, b.unif=0.2)
pollut <- fExtDep.np(method="Bayesian", data = data[,-3], u=TRUE,
cov1 = covar, cov2 = covar, mar.prelim=FALSE,
par10 = c(100,0,0,35,1), par20 = c(20,0,0,20,1),
sig10 = 0.1, sig20 = 0.1, k0 = 5,
hyperparam = hyperparam, nsim = 5e+4)
# Warning: This is slow!
}
# Example Frequentist estimation
# Data are maxima
data(WindSpeedGust)
years <- format(ParcayMeslay$time, format="%Y")
attach(ParcayMeslay[which(years %in% c(2004:2013)),])
WS_th <- quantile(WS,.9)
DP_th <- quantile(DP,.9)
pars.WS <- evd::fpot(WS, WS_th, model="pp")$estimate
pars.DP <- evd::fpot(DP, DP_th, model="pp")$estimate
data_uf <- trans2UFrechet(cbind(WS,DP), type="Empirical")
rdata <- rowSums(data_uf)
r0 <- quantile(rdata, probs=.90)
extdata <- data_uf[rdata>=r0,]
SP_mle <- fExtDep.np(method="Frequentist", data=extdata, k0=10,
type="maxima")
Run the code above in your browser using DataLab