# Fitting procedure of the HKEVP with MCMC algorithm

### Description

Metropolis-within-Gibbs algorithm that returns samples from posterior distribution of all the parameters of the HKEVP.

Most of the input parameters have default values, so that the procedure can be easily handled. However, convergence of the Markov chains should be assessed by using `mcmc.plot`

for instance. The experimented user can set initial states, prior hyperparameters along with the magnitude of the MCMC jumps.

### Usage

1 2 3 |

### Arguments

`y` |
A matrix of observed block maxima. Each column corresponds to a site position. |

`sites` |
The coordinates of the sites where the data are observed. Each row corresponds to a site position. |

`knots` |
The coordinates of the knots in the HKEVP. By default, the positions of the knots coincide with the positions of the sites. |

`niter` |
The number of MCMC iterations. |

`nburn` |
The number of first MCMC iterations that are discarded. Zero by default. |

`nthin` |
The size of the MCMC thinning. One by default (i.e. no thinning). |

`quiet` |
A logical indicating if the progression of the routine should be displayed. TRUE by default. |

`trace` |
If |

`fit.margins` |
A logical that indicates if the GEV parameters should be fitted along with the dependence structure. TRUE by default. |

`gev.vary` |
A logical vector of size three indicating if the GEV parameters (respectively the location, the scale and the shape) are spatially-varying. If not (by default for the shape), the parameter is the same at each position. |

`spatial.covariates` |
A numerical matrix of spatial covariates. Each row corresponds to a site position. See details. |

`log.scale` |
A logical value indicating if the GEV scale parameter |

`correlation` |
A character string indicating the form of the correlation function associated to the latent Gaussian processes that describes the marginal parameters. Must be one of |

`mcmc.init` |
A named list indicating the initial states of the chains. See details. |

`mcmc.prior` |
A named list indicating the hyperparameters of the prior distributions. See details. |

`mcmc.jumps` |
A named list indicating the amplitude of the jumps to propose the MCMC candidates. See details. |

### Details

Details of the MCMC procedure are presented in Reich and Shaby (2012). This function follows the indications and the choices of the authors, with the exception of several small changes:

The scale parameter

*σ*can be modelled like the two other marginal parameters as in Davison et al. (2012) or by its logarithm as in Reich and Shaby (2012). For this, use the argument`log.scale`

, set to FALSE by default.The Inverse-Gamma prior distributions defined for the bandwith parameter

*τ*and for the ranges*λ*of the latent processes are replaced by a Beta distribution over the interval*[0,2D_{max}]*, where*D_{max}*stands for the maximum distance between two sites.

The procedure can be used normally with `fit.margins = TRUE`

(default) or by assuming that the observed process had GEV(1,1,1) margins already and thus ignoring the marginal estimation.

If the margins are estimated and the parameters are assumed spatially-varying, the user can provide spatial covariates to fit the mean of the latent Gaussian processes. Recall for instance for the GEV location parameter that:

*μ(s) = β_{0,μ} + β_{1,μ} c_1(s) + ... + β_{p,μ} c_p(s) ~.*

The given matrix `spatial.covariates`

that represents the *c_i(s)* elements should have the first column filled with ones to account for the intercept *β_0*.

The arguments `mcmc.init`

, `mcmc.prior`

and `mcmc.jumps`

are named list that have default values. The user can make point changes in these arguments, by setting `mcmc.init = list(alpha = .5)`

for instance, but must respect the constraints of each element:

`mcmc.init`

. All elements are of length one. The possibilities are:`loc`

,`scale`

and`shape`

(GEV parameters).`range`

and`sill`

of the correlation functions.`alpha`

,`tau`

,`A`

and`B`

, the dependence parameters and conditional variables of the HKEVP.

mcmc.prior. The possible elements are:

`constant.gev`

: a*2 \times 3*matrix of normal parameters for spatially-constant*μ*,*σ*and*ξ*. The first row are the means, the second are the standard deviations.`beta.sd`

: the normal sd prior of all*β*parameters (a single value).`range`

,`alpha`

and`tau`

: the two Beta parameters.`sill`

: the two Inverse-Gamma parameters.

mcmc.jumps. The possible elements are:

`gev`

and`range`

: a vector of length 3 (for each GEV parameter).`tau`

,`alpha`

,`A`

,`B`

: single values for each.

### Value

A named list with following elements:

`GEV`

: the Markov chains associated to the GEV parameters. The dimensions of the array correspond respectively to the sites positions, the three GEV parameters and the states of the Markov chains.`alpha`

: the Markov chain associated to the dependence parameter*α*.`tau`

: the Markov chain associated to the dependence parameter*τ*.`A`

: the Markov chains associated to the positive stable random effect per site and per block. The dimensions correspond respectively to the indices of blocks, the knots positions and the states of the Markov chains.`llik`

: the log-likelihood of the model for each step of the algorithm.`time`

: time (in sec) spent for the fit.`spatial`

: a named list with four elements linked to the GEV spatially-varying parameters:`vary`

: the argument`gev.vary`

.`beta`

: the*β*parameters for each GEV parameter. The dimensions correspond respectively to the steps of the Markov chains, the*p*spatial covariates and the GEV parameters`sills`

: the Markov chains associated to the sills in the correlation functions of the latent Gaussian processes.`ranges`

: the Markov chains associated to the ranges in the correlation functions of the latent Gaussian processes.

`data`

: the data fitted.`sites`

: the sites where the data are observed.`knots`

: the set of knots.`spatial.covariates`

: the spatial covariates.`correlation`

: the type of correlation function for the marginal latent processes.`nstep`

: the number of steps at the end of the routine after burn-in and thinning.`log.scale`

: a boolean indicating if the scale parameter has been modelled via its logarithm.`fit.type`

: either "hkevp" or "dep-only" character string to specify the type of fit.

If `fit.margins`

is false, only the dependence-related elements are returned.

### Author(s)

Quentin Sebille

### References

Reich, B. J., & Shaby, B. A. (2012). A hierarchical max-stable spatial model for extreme precipitation. The annals of applied statistics, 6(4), 1430. <DOI:10.1214/12-AOAS591>

Stephenson, A. G. (2009) High-dimensional parametric modelling of multivariate extreme events. Aust. N. Z. J Stat, 51, 77-88. <DOI:10.1111/j.1467-842X.2008.00528.x>

Davison, A. C., Padoan, S. A., & Ribatet, M. (2012). Statistical modeling of spatial extremes. Statistical Science, 27(2), 161-186. <DOI:10.1214/11-STS376>

### See Also

latent.fit

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 | ```
# Simulation of HKEVP:
set.seed(1)
sites <- as.matrix(expand.grid(1:3,1:3))
loc <- sites[,1]*10
scale <- 3
shape <- 0
alpha <- .4
tau <- 1
ysim <- hkevp.rand(10, sites, sites, loc, scale, shape, alpha, tau)
# HKEVP fit:
fit <- latent.fit(ysim, sites, niter = 1000)
``` |