Last data update: 2014.03.03

R: Posterior Distribution with Parameters of GPD, when xi=0
posterior.gpd.expR Documentation

Posterior Distribution with Parameters of GPD, when xi=0

Description

MCMC runs of posterior distribution of data with parameters of Generalized Pareto Distribution (GPD), with parameters sigma, when xi=0.

Usage

posterior.gpd.exp(data, threshold, int)

Arguments

data

data vector

threshold

a threshold value. When threshold=0, we have the particular case of exponential.

int

number of iteractions selected in MCMC. The program selects 1 in each 10 iteraction, then thin=10. The first thin*int/3 iteractions is used as burn-in. After that, is runned thin*int iteraction, in which 1 of thin is selected for the final MCMC chain, resulting the number of int iteractions.

Value

The program has as result a vector with dimensions int, which represents points of posterior points of sigma parameter of GPD.

Examples

# Obtaining posterior distribution of a vector of simulated points
x=rgpd(1000,xi=0.0001,mu=9,beta=2) # in this case beta is the scale parameter sigma
# Obtaning 1000 points of posterior distribution
ajuste=posterior.gpd.exp(x,9,1000)
# Histogram of posterior distribution of the parameters,with 95% credibility intervals
hist(ajuste,freq=FALSE,main="mu")
abline(v=quantile(ajuste,0.025),lwd=2)
abline(v=quantile(ajuste,0.975),lwd=2)
# Absolute returns of Ibovespa
data(ibovespa)
absibv=abs(ibovespa[,4])
postibv=posterior.gpd.exp(absibv,0,1000)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MCMC4Extremes)
Loading required package: evir
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MCMC4Extremes/posterior.gpd.exp.Rd_%03d_medium.png", width=480, height=480)
> ### Name: posterior.gpd.exp
> ### Title: Posterior Distribution with Parameters of GPD, when xi=0
> ### Aliases: posterior.gpd.exp
> 
> ### ** Examples
> 
> # Obtaining posterior distribution of a vector of simulated points
> x=rgpd(1000,xi=0.0001,mu=9,beta=2) # in this case beta is the scale parameter sigma
> # Obtaning 1000 points of posterior distribution
> ajuste=posterior.gpd.exp(x,9,1000)
> # Histogram of posterior distribution of the parameters,with 95% credibility intervals
> hist(ajuste,freq=FALSE,main="mu")
> abline(v=quantile(ajuste,0.025),lwd=2)
> abline(v=quantile(ajuste,0.975),lwd=2)
> # Absolute returns of Ibovespa
> data(ibovespa)
> absibv=abs(ibovespa[,4])
> postibv=posterior.gpd.exp(absibv,0,1000)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>