Title: | Posterior Distribution of Extreme Value Models in R |
---|---|
Description: | Provides some function to perform posterior estimation for some distribution, with emphasis to extreme value distributions. It contains some extreme datasets, and functions that perform the runs of posterior points of the GPD and GEV distribution. The package calculate some important extreme measures like return level for each t periods of time, and some plots as the predictive distribution, and return level plots. |
Authors: | Fernando Ferraz do Nascimento [aut, cre], Wyara Vanesa Moura e Silva [aut, ctb] |
Maintainer: | Fernando Ferraz do Nascimento <[email protected]> |
License: | GPL-2 |
Version: | 1.1 |
Built: | 2024-12-02 06:31:55 UTC |
Source: | CRAN |
These data are the 30-day maxima rainfall at Barcelos Station, in Portugal, from 1931 to 2008. The data are contained in a numeric vector
data(barcelos)
data(barcelos)
A numeric vector containing 918 observations.
data(barcelos) hist(barcelos, main=NULL)
data(barcelos) hist(barcelos, main=NULL)
Cumulative probability, quantiles, density and random generation from the dual gamma generalized extreme value distribution.
pggev(q, xi, mu, sigma, delta) qggev(p, xi, mu, sigma, delta) dggev(x, xi, mu, sigma, delta) rggev(n, xi, mu, sigma, delta)
pggev(q, xi, mu, sigma, delta) qggev(p, xi, mu, sigma, delta) dggev(x, xi, mu, sigma, delta) rggev(n, xi, mu, sigma, delta)
q |
vector of quantiles |
p |
vector of probabilities |
x |
vector of values at which to evaluate density |
n |
sample size |
xi |
shape parameter |
mu |
location parameter |
sigma |
scale parameter |
delta |
additional shape parameter of GGEV extension |
Probability (pggev
), quantile (qggev
), density (dggev
) or random sample (rggev
) for the GGEV distribution.
Nascimento, F. F.; Bourguigon, M. ; Leao, J. S. (2015). Extended generalized extreme value distribution with applications in environmental data. HACET J MATH STAT.
These data are the 15-day maxima river food at Fajardo River, in Porto Rico, from 1967 to 2008. The data are contained in a numeric vector
data(fajardo)
data(fajardo)
A numeric vector containing 864 observations.
data(fajardo) hist(fajardo, main=NULL)
data(fajardo) hist(fajardo, main=NULL)
MCMC runs of posterior distribution of data with Gamma(alpha,beta)
density.
gammap(data, int=1000)
gammap(data, int=1000)
data |
data vector |
int |
number of iteractions selected in MCMC. The program selects 1 in each 10
iteractions, then |
An object of class gammap
that gives a list containing the points of posterior distributions of alpha
and beta
of the gamma distribution, the data, mean posterior, median posterior and the credibility interval of the parameters.
The non-informative prior distribution of these parameters are both
Gamma(0.0001,0.0001)
. During the MCMC runs, screen shows the proportion of iteractions made
# Vector of maxima return for each 10 days for ibovespa data data(ibovespa) ibmax=gev(ibovespa[,4],10)$data # obtaining 500 points of posterior distribution ibovpost=gammap(ibmax,300)
# Vector of maxima return for each 10 days for ibovespa data data(ibovespa) ibmax=gev(ibovespa[,4],10)$data # obtaining 500 points of posterior distribution ibovpost=gammap(ibmax,300)
MCMC runs of posterior distribution of data with parameters of Generalized Extreme Value (GEV)
density, with parameters mu
, sigma
and xi
.
gevp(data, block, int=1000)
gevp(data, block, int=1000)
X
data |
data vector |
block |
the block size. A numeric value is interpreted as the number of data values in each successive block. All the data is used, so the last block may not contain block observations |
int |
Number of iteractions selected in MCMC. The program selects 1 in each 10
iteraction, then |
An object of class gevp
that gives a list containing the points of posterior distributions of mu
, sigma
and xi
of the gev distribution, the data, mean posterior, median posterior and the credibility interval of the parameters.
The non-informative prior distribution of these parameters
are Normal(0,1000)
for the parameter mu
, Gamma(0.001,0.001)
for the parameter sigma
and Normal(0,100)
for parameter xi
. During the MCMC runs, screen shows the proportion of iteractions
made.
# Obtaining posterior distribution of a vector of simulated points x=rgev(300,xi=0.1,mu=10,sigma=5) # Obtaning 600 points of posterior distribution ajuste=gevp(x,1,200) # Obtaining 300 points of ponterior distribution of river nidd data ## Not run: data(nidd.annual) ## Not run: out=gevp(nidd.annual,1,300) # Vector of maxima return for each 15 days for ibovespa data ## Not run: data(ibovespa) ## Not run: postibv=gevp(ibovespa[,4],15,300) ## Not run: plot.ts(postibv$posterior)
# Obtaining posterior distribution of a vector of simulated points x=rgev(300,xi=0.1,mu=10,sigma=5) # Obtaning 600 points of posterior distribution ajuste=gevp(x,1,200) # Obtaining 300 points of ponterior distribution of river nidd data ## Not run: data(nidd.annual) ## Not run: out=gevp(nidd.annual,1,300) # Vector of maxima return for each 15 days for ibovespa data ## Not run: data(ibovespa) ## Not run: postibv=gevp(ibovespa[,4],15,300) ## Not run: plot.ts(postibv$posterior)
MCMC runs of posterior distribution of data with parameters of Dual Gamma Generalized Extreme Value Distribution
density, with parameters mu
, sigma
and xi
.
ggevp(data, block, int=1000, delta)
ggevp(data, block, int=1000, delta)
data |
data vector |
block |
the block size. A numeric value is interpreted as the number of data values in each successive block. All the data is used, so the last block may not contain block observations |
int |
Number of iteractions selected in MCMC. The program selects 1 in each 10
iteraction, then |
delta |
additional shape parameter of GGEV extension |
An object of class ggevp
that gives a list containing the points of posterior distributions of mu
, sigma
and xi
of the dual gamma generalized extreme value distribution, the data, mean posterior, median posterior and the credibility interval of the parameters.
Nascimento, F. F.; Bourguigon, M. ; Leao, J. S. (2015). Extended generalized extreme value distribution with applications in environmental data. HACET J MATH STAT.
# Obtaining posterior distribution of a vector of simulated points w=rggev(300,0.1,10,5,0.5) # Obtaning 500 points of posterior distribution with delta=0.5 ajust=ggevp(w,1,200,0.5)
# Obtaining posterior distribution of a vector of simulated points w=rggev(300,0.1,10,5,0.5) # Obtaning 500 points of posterior distribution with delta=0.5 ajust=ggevp(w,1,200,0.5)
MCMC runs of posterior distribution of data with parameters of Generalized Pareto Distribution
(GPD), with parameters sigma
and xi
.
gpdp(data, threshold, int=1000)
gpdp(data, threshold, int=1000)
data |
data vector |
threshold |
a threshold value |
int |
number of iteractions selected in MCMC. The program selects 1 in each 10
iteraction, then |
An object of class gpdp
that gives a list containing the points of posterior distributions of sigma
and xi
of the gpd distribution, the data, mean posterior, median posterior and the credibility interval of the parameters.
The joint priordistribution for these parameters is the Jeffreys prior Given as Castellanos and Cabras (2007).
Castellanos, M. A. and Cabras, S. (2007). A default Bayesian procedure for the generalized Pareto distribution, Journal of Statistical Planning and Inference, 137, 473-483.
# Obtaining posterior distribution of a vector of simulated points x=rgpd(300,xi=0.1,mu=9,beta=2) # in this case beta is the scale parameter sigma # Obtaning 1000 points of posterior distribution ajuste=gpdp(x,9, 200) # Histogram of posterior distribution of the parameters,with 95% credibility intervals # Danish data for evir package, modelling losses over 10 ## Not run data(danish) ## Not run out=gpdp(danish,10,300)
# Obtaining posterior distribution of a vector of simulated points x=rgpd(300,xi=0.1,mu=9,beta=2) # in this case beta is the scale parameter sigma # Obtaning 1000 points of posterior distribution ajuste=gpdp(x,9, 200) # Histogram of posterior distribution of the parameters,with 95% credibility intervals # Danish data for evir package, modelling losses over 10 ## Not run data(danish) ## Not run out=gpdp(danish,10,300)
MCMC runs of posterior distribution of data with parameters of Generalized Extreme Value (GEV)
density, in the particular case where xi=0
with parameters mu
, sigma
.
gumbelp(data, block, int=1000)
gumbelp(data, block, int=1000)
data |
data vector |
block |
the block size. A numeric value is interpreted as the number of data values in each successive block. All the data is used, so the last block may not contain block observations. |
int |
number of iteractions selected in MCMC. The program selects 1 in each 10
iteraction, then |
An object of class gumbelp
that gives a list containing the points of posterior distributions of mu
and sigma
of the gev distribution, the data, mean posterior, median posterior and the credibility interval of the parameters.
The non-informative prior distribution of these parameters are Normal(0,1000)
for the
parameter mu
and Gamma(0.001,0.001)
for the parameter sigma
. During the MCMC runs, screen
shows the proportion of iteractions made.
# Obtaining posterior distribution of a vector of simulated points x=rgev(200,xi=0.0001,mu=10,sigma=5) # Obtaning 600 points of posterior distribution ajuste=gumbelp(x,1,600) # Maxima of each month in river nidd data ## Not run: data(nidd.annual) ## Not run: out=gumbelp(nidd.annual,1,500) # Predictive distribution for 15 day maxima ibovespa returns ## Not run: data(ibovespa) ## Not run: postibv=gumbelp(ibovespa[,4],15,500)
# Obtaining posterior distribution of a vector of simulated points x=rgev(200,xi=0.0001,mu=10,sigma=5) # Obtaning 600 points of posterior distribution ajuste=gumbelp(x,1,600) # Maxima of each month in river nidd data ## Not run: data(nidd.annual) ## Not run: out=gumbelp(nidd.annual,1,500) # Predictive distribution for 15 day maxima ibovespa returns ## Not run: data(ibovespa) ## Not run: postibv=gumbelp(ibovespa[,4],15,500)
These data are the monthly maximum river quota of Gurgueia River, in Brazil, from 1975 to 2012.
data(gurgueia)
data(gurgueia)
A data frame with 415 observations on the following 2 variables.
date
month/year
maximum
a numeric vector with monthly maximum
data(gurgueia) hist(gurgueia[,2], main=NULL)
data(gurgueia) hist(gurgueia[,2], main=NULL)
These data are the daily returns of ibovespa from 2000 to 2009.
data(ibovespa)
data(ibovespa)
A data frame with 2369 observations on the following 4 variables.
month
a numeric vector with month
day
a numeric vector with day
year
a numeric vector with year
returns
a numeric vector with returns
data(ibovespa) hist(ibovespa[,4], main=NULL)
data(ibovespa) hist(ibovespa[,4], main=NULL)
MCMC runs of posterior distribution of data with Normal(mu,1/tau)
density, where tau
is the inverse
of variance.
normalp(data, int=1000)
normalp(data, int=1000)
data |
data vector |
int |
number of iteractions selected in MCMC. The program selects 1 in each 10
iteraction, then |
An object of class gumbelp
that gives a list containing the points of posterior distributions of mu
and tau
of the normal distribution, the data, mean posterior, median posterior and the credibility interval of the parameters.
The non-informative prior distribution of these parameters are Normal(0,10000000)
for the parameter mu and Gamma(0.001,0.001)
for the parameter tau
. During the MCMC runs,
screen shows the proportion of iteractions made.
# Obtaining posterior distribution of a vector of simulated points x=rnorm(300,2,sqrt(10)) # Obtaning 1000 points of posterior distribution ajuste=normalp(x, 200) # Posterior distribution of river Nile dataset ## Not run: data(Nile) ## Not run: postnile=normalp(Nile,1000)
# Obtaining posterior distribution of a vector of simulated points x=rnorm(300,2,sqrt(10)) # Obtaning 1000 points of posterior distribution ajuste=normalp(x, 200) # Posterior distribution of river Nile dataset ## Not run: data(Nile) ## Not run: postnile=normalp(Nile,1000)
The plot method plot.gevp provides three differents plots: a histogram of the gev parameters, a plot of predictive density resulting of posterior distribution of GEV parameters, and a return level plot of GEV distribution.
## S3 method for class 'gevp' plot(x, type = c("histogram", "predictive", "retlevel"), t=2, k=100, ...)
## S3 method for class 'gevp' plot(x, type = c("histogram", "predictive", "retlevel"), t=2, k=100, ...)
x |
a |
type |
which chosen plot |
t |
start return level |
k |
end return level |
... |
other graphics parameters |
# Return level of river nidd data data(nidd.annual) out=gevp(nidd.annual,1,300) ## Not run: plot(out,"histogram") plot(out,"predictive") ## Not run: plot(out,"retlevel", 10, 50)
# Return level of river nidd data data(nidd.annual) out=gevp(nidd.annual,1,300) ## Not run: plot(out,"histogram") plot(out,"predictive") ## Not run: plot(out,"retlevel", 10, 50)
The plot method plot.ggevp provides three differents plots: a histogram of the GGEV parameters, a plot of predictive density resulting of posterior distribution of GGEV parameters, and a return level plot of GGEV distribution.
## S3 method for class 'ggevp' plot(x, type = c("histogram", "predictive", "retlevel"), t=2, k = 100, ...)
## S3 method for class 'ggevp' plot(x, type = c("histogram", "predictive", "retlevel"), t=2, k = 100, ...)
x |
a |
type |
which chosen plot |
t |
start return level |
k |
end return level |
... |
other graphics parameters |
Nascimento, F. F.; Bourguigon, M. ; Leao, J. S. (2015). Extended generalized extreme value distribution with applications in environmental data. HACET J MATH STAT.
# Obtaining posterior distribution of a vector of simulated points w=rggev(300,0.4,10,5,0.5) # Obtaning 300 points of posterior distribution with delta=0.5 fit=ggevp(w,1,200,0.5) ## Not run: plot(fit,"histogram") plot(fit,"predictive") ## Not run: plot(fit,"retlevel", 10, 50)
# Obtaining posterior distribution of a vector of simulated points w=rggev(300,0.4,10,5,0.5) # Obtaning 300 points of posterior distribution with delta=0.5 fit=ggevp(w,1,200,0.5) ## Not run: plot(fit,"histogram") plot(fit,"predictive") ## Not run: plot(fit,"retlevel", 10, 50)
The plot method plot.gpdp provides three differents plots: a histogram of the GPD parameters, a plot of predictive density resulting of posterior distribution of GPD parameters, and a return level plot of GPD distribution.
## S3 method for class 'gpdp' plot(x, type = c("histogram", "predictive", "retlevel"), t=2, k=100, ...)
## S3 method for class 'gpdp' plot(x, type = c("histogram", "predictive", "retlevel"), t=2, k=100, ...)
x |
a |
type |
which chosen plot |
t |
start return level |
k |
end return level |
... |
other graphics parameters |
data(danish) out=gpdp(danish,10,300) ## Not run: plot(out,"histogram") ## Not run: plot(out,"predictive") plot(out,"retlevel", 10, 50)
data(danish) out=gpdp(danish,10,300) ## Not run: plot(out,"histogram") ## Not run: plot(out,"predictive") plot(out,"retlevel", 10, 50)
The plot method plot.gumbelp provides three differents plots: a histogram of the gumbel parameters, a plot of predictive density resulting of posterior distribution of gumbel parameters, and a return level plot of gumbel distribution.
## S3 method for class 'gumbelp' plot(x, type = c("histogram", "predictive", "retlevel"), t=2, k=100, ...)
## S3 method for class 'gumbelp' plot(x, type = c("histogram", "predictive", "retlevel"), t=2, k=100, ...)
x |
a |
type |
which chosen plot |
t |
start return level |
k |
end return level |
... |
other graphics parameters |
data(nidd.annual) out=gumbelp(nidd.annual,1,500) ## Not run: plot(out,"histogram") ## Not run: plot(out,"predictive") plot(out,"retlevel", 10)
data(nidd.annual) out=gumbelp(nidd.annual,1,500) ## Not run: plot(out,"histogram") ## Not run: plot(out,"predictive") plot(out,"retlevel", 10)
The plot method plot.normalp provides three differents plots: a histogram of the normal parameters, a plot of predictive density resulting of posterior distribution of normal parameters, and a return level plot of normal distribution.
## S3 method for class 'normalp' plot(x, type = c("histogram"), ...)
## S3 method for class 'normalp' plot(x, type = c("histogram"), ...)
x |
a |
type |
which chosen plot |
... |
other graphics parameters |
data(Nile) p=normalp(Nile,600) plot(p,"histogram")
data(Nile) p=normalp(Nile,600) plot(p,"histogram")
summary method for class "gevp"
## S3 method for class 'gevp' summary(object, ...)
## S3 method for class 'gevp' summary(object, ...)
object |
an object of class |
... |
further arguments passed to or from other methods. |
The function summary.gevp
computes and returns a list of summary statistics of the posterior distribution given in object
.
postmean |
mean posterior |
postmedian |
median posterior |
postCI |
credibility interval |
fitm |
fit measures for standard GEV model |
# Return level of river nidd data data(nidd.annual) out=gevp(nidd.annual,1,300) a=summary(out) a
# Return level of river nidd data data(nidd.annual) out=gevp(nidd.annual,1,300) a=summary(out) a
summary method for class "ggevp"
## S3 method for class 'ggevp' summary(object, ...)
## S3 method for class 'ggevp' summary(object, ...)
object |
an object of class |
... |
further arguments passed to or from other methods. |
The function summary.ggevp
computes and returns a list of summary statistics of the posterior distribution given in object
.
postmean |
mean posterior |
postmedian |
median posterior |
postCI |
credibility interval |
fitm |
fit measures for standard GGEV model |
Nascimento, F. F.; Bourguigon, M. ; Leao, J. S. (2015). Extended generalized extreme value distribution with applications in environmental data. HACET J MATH STAT.
# Obtaining posterior distribution of a vector of simulated points w=rggev(300,0.4,10,5,0.5) # Obtaning 600 points of posterior distribution with delta=0.5 fit=ggevp(w,1,200,0.5) a=summary(fit) # Choice the best delta from a Grid of possible values as Nascimento et al. (2015) ## Not run: fitmeasures=summary(fit)$fitm ## Not run: delta=seq(0.1,2,0.2) ## Not run: results=array(0,c(length(delta),4)) ## Not run: for (i in 1:length(delta)) ## Not run: {ajust=ggevp(w,1,200,delta[i]) ## Not run: results[i,]=summary(ajust)$fitm} # As commented in Nascimento 2015 paper, a criteria to choice the best delta would be # create a grid of values of theta and choose the best according the lowest fit measures ## Not run: resultsb=cbind(delta,results) ## Not run: colnames(resultsb)=c("delta","AIC","BIC","pD","DIC")
# Obtaining posterior distribution of a vector of simulated points w=rggev(300,0.4,10,5,0.5) # Obtaning 600 points of posterior distribution with delta=0.5 fit=ggevp(w,1,200,0.5) a=summary(fit) # Choice the best delta from a Grid of possible values as Nascimento et al. (2015) ## Not run: fitmeasures=summary(fit)$fitm ## Not run: delta=seq(0.1,2,0.2) ## Not run: results=array(0,c(length(delta),4)) ## Not run: for (i in 1:length(delta)) ## Not run: {ajust=ggevp(w,1,200,delta[i]) ## Not run: results[i,]=summary(ajust)$fitm} # As commented in Nascimento 2015 paper, a criteria to choice the best delta would be # create a grid of values of theta and choose the best according the lowest fit measures ## Not run: resultsb=cbind(delta,results) ## Not run: colnames(resultsb)=c("delta","AIC","BIC","pD","DIC")
summary method for class "gpdp"
## S3 method for class 'gpdp' summary(object, ...)
## S3 method for class 'gpdp' summary(object, ...)
object |
an object of class |
... |
further arguments passed to or from other methods. |
The function summary.ggevp
computes and returns a list of summary statistics of the posterior distribution given in object
.
postmean |
mean posterior |
postmedian |
median posterior |
postCI |
credibility interval |
fitm |
fit measures for standard GPD model |
data(danish) out=gpdp(danish,10,300) a=summary(out) a
data(danish) out=gpdp(danish,10,300) a=summary(out) a
summary method for class "gumbelp"
## S3 method for class 'gumbelp' summary(object, ...)
## S3 method for class 'gumbelp' summary(object, ...)
object |
an object of class |
... |
further arguments passed to or from other methods. |
The function summary.gumbelp
computes and returns a list of summary statistics of the posterior distribution given in object
.
postmean |
mean posterior |
postmedian |
median posterior |
postCI |
credibility interval |
fitm |
fit measures for standard Gumbel model |
# Example with simulated datapoints x=rgev(300,0.01,10,5) fit=gumbelp(x,1,300) fitgum=summary(fit) # Compare if the fit measures of gumbel is better than measures using GEV ## Not run: fit2=gevp(x,1,300) ## Not run: fitgev=summary(fit2) # the best model is that with lowest fit measures
# Example with simulated datapoints x=rgev(300,0.01,10,5) fit=gumbelp(x,1,300) fitgum=summary(fit) # Compare if the fit measures of gumbel is better than measures using GEV ## Not run: fit2=gevp(x,1,300) ## Not run: fitgev=summary(fit2) # the best model is that with lowest fit measures