rm(list=ls()) library(SpatialExtremes) ## First load some data (already formatted) data(rainfall) ## Transform the data to unit Fréchet first frechet <- apply(rain, 2, gev2frech, emp = TRUE) ## <<-- we use the empirical CDF ## Fit a bunch of max-stable models using pairwise likelihood M0 <- fitmaxstab(frechet, coord[,1:2], "whitmat", nugget = 0) M1 <- fitmaxstab(frechet, coord[,1:2], "gauss", iso = TRUE, start = list(cov = 10)) ## <<- you can supply starting values as a named list---usefull to bypass convergence issues... M2 <- fitmaxstab(frechet, coord[,1:2], "tpowexp", nugget = 0) M3 <- fitmaxstab(frechet, coord[,1:2], "brown") ## Compare the empirical extremal coefficient cloud with fitted extremal coefficient function fmadogram(rain, coord[,1:2], which = "ext", col = "grey") fmadogram(fitted = M0, which = "ext", n.bins = 200, add = TRUE)## <<- you can pass a fitted model also plot(M1$ext.coeff, from = 0, to = 120, col = 3, add = TRUE) plot(M2$ext.coeff, from = 0, to = 120, col = 4, add = TRUE) plot(M3$ext.coeff, from = 0, to = 120, col = 5, add = TRUE) legend("bottomright", c("Schlather", "Smith", "Extremal-t", "Brown-Resnick"), col = 2:5, lty = 1, bty = "n", inset = 0.05)