This function generates a Markov chain from a Bayesian hierarchical model for block maxima assuming conditional independence.
latent(data, coord, cov.mod = "powexp", loc.form, scale.form,
shape.form, marg.cov = NULL, hyper, prop, start, n = 5000, thin = 1,
burn.in = 0, use.log.link = FALSE)
A matrix representing the data. Each column corresponds to one location.
A matrix that gives the coordinates of each location. Each row corresponds to one location.
A character string corresponding to the covariance model for the Gaussian latent processes. Must be one of "gauss" for the Smith's model; "whitmat", "cauchy", "powexp" or "bessel" or for the Whittle-Matern, the Cauchy, the Powered Exponential and the Bessel correlation families.
R formulas defining the spatial linear model for the mean of the latent processes.
Matrix with named columns giving additional covariates
for the latent processes means. If NULL
, no extra covariates are
used.
A named list specifying the hyper-parameters --- see Details.
A named list specifying the jump sizes when a Metropolis--Hastings move is needed --- see Details.
A named list specifying the starting values --- see Details.
The effective length of the simulated Markov chain i.e., once the burnin period has been discarded and after thinning.
An integer specifying the thinning length. The default is 1, i.e., no thinning.
An integer specifying the burnin period. The default is 0, i.e., no burnin.
An integer. Should a log-link function should be use for the GEV scale parameters, i.e., assuming that the GEV scale parameters a drawn from a log-normal process rather than a gaussian process.
A list
This function can be time consuming and makes an intensive use of BLAS routines so it is (much!) faster if you have an optimized BLAS.
The starting values will never be stored in the generated Markov chain
even when burn.in=0
.
This function generates a Markov chain from the following model. For
each
A joint prior density must be defined for the sills, ranges, shapes
parameters of the covariance functions as well as for the regression
parameters
Consequently hyper
is a named list with named components
A list with three components named 'loc', 'scale' and 'shape' each of these is a 2-length vector specifying the shape and the scale of the inverse Gamma prior distribution for the sill parameter of the covariance functions;
A list with three components named 'loc', 'scale' and 'shape' each of these is a 2-length vector specifying the shape and the scale of the Gamma prior distribution for the range parameter of the covariance functions.
A list with three components named 'loc', 'scale' and 'shape' each of these is a 2-length vector specifying the shape and the scale of the Gamma prior distribution for the shape parameter of the covariance functions;
A list with three components named 'loc', 'scale' and 'shape' each of these is a vector specifying the mean vector of the multivariate normal prior distribution for the regression parameters;
A list with three components named 'loc', 'scale' and 'shape' each of these is a matrix specifying the inverse of the covariance matrix of the multivariate normal prior distribution for the regression parameters.
As no conjugate prior exists for the GEV parameters and the range and
shape parameters of the covariance functions, Metropolis--Hastings
steps are needed. The proposals prop
which is a list with three named components
A vector of length 3 specifying the standard deviations of the proposal distributions. These are taken to be normal distribution for the location and shape GEV parameters and a log-normal distribution for the scale GEV parameters;
A vector of length 3 specifying the jump sizes for the
range parameters of the covariance functions ---
A vector of length 3 specifying the jump sizes for
the shape parameters of the covariance functions ---
If one want to held fixed a parameter this can be done by setting a null jump size then the parameter will be held fixed to its starting value.
Finally start
must be a named list with 4 named components
A vector of length 3 specifying the starting values for the sill of the covariance functions;
A vector of length 3 specifying the starting values for the range of the covariance functions;
A vector of length 3 specifying the starting values for the shape of the covariance functions;
A named list with 3 components 'loc', 'scale' and 'shape' each of these is a numeric vector specifying the starting values for the regression coefficients.
Banerjee, S., Carlin, B. P., and Gelfand, A. E. (2004). Hierarchical Modeling and Analysis for Spatial Data. Chapman & Hall/CRC, New York.
Casson, E. and Coles, S. (1999) Spatial regression models for extremes. Extremes 1,449--468.
Cooley, D., Nychka, D. and Naveau, P. (2007) Bayesian spatial modelling of extreme precipitation return levels Journal of the American Statistical Association 102:479, 824--840.
Davison, A.C., Padoan, S.A. and Ribatet, M. Statistical Modelling of Spatial Extremes. Submitted.
# NOT RUN {
## Generate realizations from the model
n.site <- 30
n.obs <- 50
coord <- cbind(lon = runif(n.site, -10, 10), lat = runif(n.site, -10 , 10))
gp.loc <- rgp(1, coord, "powexp", sill = 4, range = 20, smooth = 1)
gp.scale <- rgp(1, coord, "powexp", sill = 0.4, range = 5, smooth = 1)
gp.shape <- rgp(1, coord, "powexp", sill = 0.01, range = 10, smooth = 1)
locs <- 26 + 0.5 * coord[,"lon"] + gp.loc
scales <- 10 + 0.2 * coord[,"lat"] + gp.scale
shapes <- 0.15 + gp.shape
data <- matrix(NA, n.obs, n.site)
for (i in 1:n.site)
data[,i] <- rgev(n.obs, locs[i], scales[i], shapes[i])
loc.form <- y ~ lon
scale.form <- y ~ lat
shape.form <- y ~ 1
hyper <- list()
hyper$sills <- list(loc = c(1,8), scale = c(1,1), shape = c(1,0.02))
hyper$ranges <- list(loc = c(2,20), scale = c(1,5), shape = c(1, 10))
hyper$smooths <- list(loc = c(1,1/3), scale = c(1,1/3), shape = c(1, 1/3))
hyper$betaMeans <- list(loc = rep(0, 2), scale = c(9, 0), shape = 0)
hyper$betaIcov <- list(loc = solve(diag(c(400, 100))),
scale = solve(diag(c(400, 100))),
shape = solve(diag(c(10), 1, 1)))
## We will use an exponential covariance function so the jump sizes for
## the shape parameter of the covariance function are null.
prop <- list(gev = c(1.2, 0.08, 0.08), ranges = c(0.7, 0.8, 0.7), smooths = c(0,0,0))
start <- list(sills = c(4, .36, 0.009), ranges = c(24, 17, 16), smooths
= c(1, 1, 1), beta = list(loc = c(26, 0.5), scale = c(10, 0.2),
shape = c(0.15)))
mc <- latent(data, coord, loc.form = loc.form, scale.form = scale.form,
shape.form = shape.form, hyper = hyper, prop = prop, start = start,
n = 10000, burn.in = 5000, thin = 15)
mc
# }
Run the code above in your browser using DataLab