fggpd | R Documentation |
Fit of the GGPD model using an MCMC algorithm.
fggpd(x, it, start = NULL, var = NULL, prior = NULL, thin = 1, burn = 0)
x |
A vector of positive observations. |
it |
Number of iterations of the algorithm. |
start |
A list of starting parameter values. |
var |
A list of starting proposal variances. |
prior |
A list of hyperparameters for the prior distribution. |
thin |
Thinning interval. |
burn |
Burn-in length. |
Estimation of the GGPD is carried out using an adaptive block Metropolis-Hastings algorithm. As standard, the user needs to specify the data to use during estimation, the number of iterations of the algorithm, the burn-in period (by default equal to zero) and the thinning interval (by default equal to one). To run the algorithm it is also needed the choice of the starting values, the starting values of the proposal variances, and the parameters of the prior distribution. If not provided, these are automatically set as follows:
starting values: u
is chosen by the function ithresh
of the threshr
package; \xi
and \sigma
are chosen by the fpot
function of evd
for data over the threshold; \mu
and \eta
are chosen as the maximum likelihood estimate of the Gamma distribution over data below the threshold.
variances: variances are chosen as the standard deviation of the normal distribution whose 0.01 quantile is equal to 0.9 times the starting value of the associated parameter.
prior distributions: the prior distribution for \xi
and \sigma
is the objective prior
p(\xi,\sigma) = \sigma^{-1}(1+\xi)^{-1}(1+2\xi)^{-1/2}.
The prior for the threshold u
is Normal with mean chosen as for the starting values and the standard deviation is chosen so that the 0.05 quantile of the prior is equal to the median of the data. The priors for the parameters \mu
and \eta
are Gammas with mean chosen as for the starting values and shapes equal to 0.001 so to give high prior variances.
The user can also select any of the three inputs above.
The starting values start
must be a list with entries xi
, sigma
, u
, mu
, eta
.
The variances var
must be a list with entries xi
, sigma
, u
, mu
, eta
.
The prior prior
must be a list with entries u
, mu
, eta
all containing a vector of length two (for u
giving the mean and the standard deviation of the Normal prior, for mu
and eta
giving the mean and shape of the Gamma prior).
fggpd
returns a list with three elements:
chain
: a matrix of size (it
- burn
)/thin
\times
5, reporting in each column the posterior sample for each parameter.
var
: a matrix of size it
\times
5 reporting the variance of the proposal distribution for each parameter.
data
: the dataset used for estimation.
Behrens, Cibele N., Hedibert F. Lopes, and Dani Gamerman. "Bayesian analysis of extreme events with threshold estimation." Statistical Modelling 4.3 (2004): 227-244.
do Nascimento, Fernando Ferraz, Dani Gamerman, and Hedibert Freitas Lopes. "A semiparametric Bayesian approach to extreme value estimation." Statistics and Computing 22.2 (2012): 661-675.
ggpd
## Small number of iterations and burn-in for quick execution
data(rainfall)
model1 <- fggpd(rainfall, it = 250, burn = 50, thin = 25)
start <- list(xi = 0.2, sigma = 2, u = 10, mu = 5, eta = 2)
var <- list(xi = 0.01, sigma = 1, u = 3, mu = 3, eta = 1)
prior <- list(u = c(22,5), mu = c(4,16), eta = c(0.001,0.001))
model2 <- fggpd(rainfall,it = 250, start = start, var =var, prior = prior)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.