require(RandomFields)
n.site <- 50
n.obs <- 100
locations <- matrix(runif(2*n.site, 0, 40), ncol = 2)
colnames(locations) <- c("lon", "lat")
sigma <- matrix(c(200, 10, 10, 300),ncol = 2)
sigma.inv <- solve(sigma)
sqrtCinv <- t(chol(sigma.inv))
model <- list(list(model = "gauss", var = 1, aniso = sqrtCinv / 2))
## Simulate a max-stable process - with unit Frechet margins
ms1 <- MaxStableRF(locations, model = model, maxstable = "Bool", grid = FALSE, n = n.obs)
ms1 <- t(ms1)
fitcovmat(ms1, locations, marge = "emp")Run the code above in your browser using DataLab