Functions
Parameter estimation
Extremes.gevfit
— Functiongevfit()
Estimate the GEV parameters by maximum likelihood.
Implementation
The function uses Nelder-Mead solver implemented in the Optim.jl package to find the point where the log-likelihood is maximal.
The GEV parameters can be modeled as function of covariates as follows:
\[μ = X₁ × β₁,\]
\[ϕ = X₂ × β₂,\]
\[ξ = X₃ × β₃.\]
The covariates are standardized before estimating the parameters to help fit the model. They are transformed back on their original scales before returning the fitted model.
See also gevfit
for the other methods, gevfitpwm
, gevfitbayes
and BlockMaxima
.
Extremes.gevfit
— Methodgevfit(model::{BlockMaxima{GeneralizedExtremeValue}}, initialvalues::Vector{<:Real})
Estimate the parameters of the BlockMaxima
model using the given initialvalues.
Extremes.gevfit
— Methodgevfit(df::DataFrame,
datacol::Symbol,
locationcovid = Vector{Symbol}(),
logscalecovid = Vector{Symbol}(),
shapecovid = Vector{Symbol}()
)
Estimate the GEV parameters.
Arguments
df::DataFrame
: The dataframe containing the data.datacol::Symbol
: The symbol of the column ofdf
containing the block maxima data.initialvalues::Vector{<:Real}
: Vector of parameters initial values.locationcovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the location parameter.logscalecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the log-scale parameter.shapecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the shape parameter.
Extremes.gevfit
— Methodgevfit(df::DataFrame,
datacol::Symbol,
locationcovid = Vector{Symbol}(),
logscalecovid = Vector{Symbol}(),
shapecovid = Vector{Symbol}()
)
Estimate the GEV parameters.
Arguments
df::DataFrame
: The dataframe containing the data.datacol::Symbol
: The symbol of the column ofdf
containing the block maxima data.locationcovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the location parameter.logscalecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the log-scale parameter.shapecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the shape parameter.
Extremes.gevfit
— Methodgevfit(y,
initialvalues,
locationcov = Vector{Variable}(),
logscalecov = Vector{Variable}(),
shapecov = Vector{Variable}()
)
Estimate the GEV parameters.
Arguments
y::Vector{<:Real}
: the vector of block maxima.initialvalues::Vector{<:Real}
: Vector of parameters initial values.locationcov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the location parameter.logscalecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the log-scale parameter.shapecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the shape parameter.
Extremes.gevfit
— Methodgevfit(y,
locationcov = Vector{Variable}(),
logscalecov = Vector{Variable}(),
shapecov = Vector{Variable}()
)
Estimate the GEV parameters.
Arguments
y::Vector{<:Real}
: The vector of block maxima.locationcov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the location parameter.logscalecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the log-scale parameter.shapecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the shape parameter.
Extremes.gumbelfit
— Functiongumbelfit()
Estimate the Gumbel parameters by maximum likelihood.
Details
The Gumbel distribution is a particular case of the generalized extreme value distribution when the shape parameter is zero.
In extreme value theory, it is best to avoid the choice of a sub-family of extreme value familu as the Gumbel. This is because the choice of family is made with the data at hand, and when extrapolating to large quantiles, i.e. larger than the range of the data, the uncertainty associated with this choice is not taken into account. If the data suggest that the Gumbel family is the best one, this does not imply that the other families are not plausible. In applications, the confidence intervals on the shape parameter are often wide, representing the difficulty of discriminating the tail behavior using only the limited number of data. Therefore, the use of the GEV distribution for the block maxima model makes more sense. As Coles (2001) also argued in Page 64, this is "...the safest option is to accept there is uncertainty about the value of the shape parameter ... and to prefer the inference based on the GEV model. The larger measures of uncertainty generated by the GEV model then provide a more realistic quantification of the genuine uncertainties involved in model extrapolation."
Implementation
The function uses Nelder-Mead solver implemented in the Optim.jl package to find the point where the log-likelihood is maximal.
The Gumbel parameters can be modeled as function of covariates as follows:
\[μ = X₁ × β₁,\]
\[ϕ = X₂ × β₂,\]
The covariates are standardized before estimating the parameters to help fit the model. They are transformed back on their original scales before returning the fitted model.
See also gumbelfit
for the other methods and gevfit
for estiming the parameters of the GEV distribution.
Extremes.gumbelfit
— Methodgumbelfit(model::{BlockMaxima{Gumbel}}, initialvalues::Vector{<:Real})
Estimate the parameters of the BlockMaxima
model using the given initialvalues.
Extremes.gumbelfit
— Methodgumbelfit(df::DataFrame,
datacol::Symbol,
locationcovid = Vector{Symbol}(),
logscalecovid = Vector{Symbol}()
)
Estimate the Gumbel parameters.
Arguments
df::DataFrame
: The dataframe containing the data.datacol::Symbol
: The symbol of the column ofdf
containing the block maxima data.initialvalues::Vector{<:Real}
: Vector of parameters initial values.locationcovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the location parameter.logscalecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the log-scale parameter.
Extremes.gumbelfit
— Methodgumbelfit(df::DataFrame,
datacol::Symbol,
locationcovid = Vector{Symbol}(),
logscalecovid = Vector{Symbol}(),
shapecovid = Vector{Symbol}()
)
Estimate the Gumbel parameters.
Arguments
df::DataFrame
: The dataframe containing the data.datacol::Symbol
: The symbol of the column ofdf
containing the block maxima data.locationcovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the location parameter.logscalecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the log-scale parameter.
Extremes.gumbelfit
— Methodgumbelfit(y,
initialvalues,
locationcov = Vector{Variable}(),
logscalecov = Vector{Variable}()
)
Estimate the Gumbel parameters.
Arguments
y::Vector{<:Real}
: the vector of block maxima.initialvalues::Vector{<:Real}
: Vector of parameters initial values.locationcov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the location parameter.logscalecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the log-scale parameter.
Extremes.gumbelfit
— Methodgumbelfit(y,
locationcov = Vector{Variable}(),
logscalecov = Vector{Variable}()
)
Estimate the Gumbel parameters.
Arguments
y::Vector{<:Real}
: The vector of block maxima.locationcov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the location parameter.logscalecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the log-scale parameter.
Extremes.gpfit
— Functiongpfit(...)
Estimate the GP parameters by maximum likelihood.
Data provided must be the exceedances above the threshold, i.e. the data above the threshold minus the threshold.
Implementation
The function uses Nelder-Mead solver implemented in the Optim.jl package to find the point where the log-likelihood is maximal.
The GP parameters can be modeled as function of covariates as follows:
\[ϕ = X₂ × β₂,\]
\[ξ = X₃ × β₃.\]
The covariates are standardized before estimating the parameters to help fit the model. They are transformed back on their original scales before returning the fitted model.
See also gpfit
for the other methods, gpfitpwm
, gpfitbayes
and ThresholdExceedance
.
Extremes.gpfit
— Methodgpfit(df::DataFrame,
datacol::Symbol,
logscalecovid = Vector{Symbol}(),
shapecovid = Vector{Symbol}()
)
Estimate the GP parameters
Arguments
df::DataFrame
: The dataframe containing the data.datacol::Symbol
: The symbol of the column ofdf
containing the exceedances.initialvalues::Vector{<:Real}
: Vector of parameters initial values.logscalecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the log-scale parameter.shapecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the shape parameter.
Extremes.gpfit
— Methodgpfit(df::DataFrame,
datacol::Symbol,
logscalecovid = Vector{Symbol}(),
shapecovid = Vector{Symbol}()
)
Estimate the GP parameters
Arguments
df::DataFrame
: The dataframe containing the data.datacol::Symbol
: The symbol of the column ofdf
containing the exceedances.logscalecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the log-scale parameter.shapecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the shape parameter.
Extremes.gpfit
— Methodgpfit(model::ThresholdExceedance, initialvalues::Vector{<:Real})
Estimate the parameters of the ThresholdExceedance
model using the given initialvalues.
Extremes.gpfit
— Methodgpfit(y,
initialvalues;
logscalecov = Vector{Variable}(),
shapecov = Vector{Variable}()
)
Estimate the GP parameters
Arguments
y::Vector{<:Real}
: The vector of exceedances.initialvalues::Vector{<:Real}
: The vector of parameters initial values.logscalecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the log-scale parameter.shapecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the shape parameter.
Extremes.gpfit
— Methodgpfit(y,
logscalecov = Vector{Variable}(),
shapecov = Vector{Variable}()
)
Estimate the GP parameters
Arguments
y::Vector{<:Real}
: The vector of exceedances.logscalecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the log-scale parameter.shapecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the shape parameter.
Extremes.gevfitpwm
— Functiongevfitpwm(...)
Estimate the GEV parameters with the probability weighted moments.
Implementation
Estimation with the probability weighted moments, as described by Hosking et al. (1985), is only possible in the stationary case.
See also gevfitpwm
for the other methods, gevfit
, gevfitbayes
and BlockMaxima
.
Reference
Hosking, J. R. M., Wallis, J. R. and Wood, E. F. (1985). Estimation of the generalized extreme-value distribution by the method of probability-weighted moments. Technometrics, 27:251-261.
Extremes.gevfitpwm
— Methodgevfitpwm(model::BlockMaxima{GeneralizedExtremeValue})
Estimate the GEV parameters with the probability weighted moments.
Extremes.gevfitpwm
— Methodgevfitpwm(df::DataFrame, datacol::Symbol)
Estimate the GEV parameters with the probability weighted moments.
Block maxima data are in the column datacol
of the dataframe df
.
Extremes.gevfitpwm
— Methodgevfitpwm(y::Vector{<:Real})
Estimate the GEV parameters with the probability weighted moments.
Extremes.gumbelfitpwm
— Functiongumbelfitpwm(...)
Estimate the Gumbel parameters with the probability weighted moments.
Implementation
Estimation with the probability weighted moments, as described by Landwehr *et al. (1979), is only possible in the stationary case.
See also gumbelfitpwm
for the other methods, gevfit
, gevfitbayes
and BlockMaxima
.
Reference
Landwehr, J. M., Matalas, N. C. and Wallis, J. R. (1979). Probability weighted moments compared with some traditional techniques in estimating Gumbel parameters and quantiles. Water Resources Research, 15:1055–1064.
Extremes.gumbelfitpwm
— Methodgumbelfitpwm(model::BlockMaxima{Gumbel})
Estimate the Gumbel parameters with the probability weighted moments.
Extremes.gumbelfitpwm
— Methodgumbelfitpwm(df::DataFrame, datacol::Symbol)::pwmAbstractExtremeValueModel
Estimate the Gumbel parameters with the probability weighted moments.
Block maxima data are in the column datacol
of the dataframe df
.
Extremes.gumbelfitpwm
— Methodgumbelfitpwm(y::Vector{<:Real})
Estimate the Gumbel parameters with the probability weighted moments.
Extremes.gpfitpwm
— Functiongpfitpwm(...)
Estimate the GP parameters with the probability weighted moments.
Implementation
Estimation with the probability weighted moments, as described by Hosking and Wallis (1987), is only possible in the stationary case.
See also gpfitpwm
for the other methods, gpfit
, gpfitbayes
and ThresholdExceedance
.
Reference
Hosking, J. R. M. and Wallis, J. R. (1987). Parameter and quantile estimation for the Generalized Pareto distribution, Technometrics, 29:339-349.
Extremes.gpfitpwm
— Methodgpfitpwm(df::DataFrame, datacol::Symbol)
Estimate the GP parameters with the probability weighted moments.
Block maxima data are in the column datacol
of the dataframe df
.
Extremes.gpfitpwm
— Methodgpfitpwm(model::ThresholdExceedance)
Estimate the GP parameters with the probability weighted moments.
Extremes.gpfitpwm
— Methodgpfitpwm(y::Vector{<:Real})
Estimate the GP parameters with the probability weighted moments.
Extremes.gevfitbayes
— Functiongevfitbayes(..., niter::Int=5000, warmup::Int=2000)
Generate a sample from the GEV parameters' posterior distribution.
Arguments
niter::Int = 5000
: The total number of MCMC iterations.warmup::Int = 2000
: The number of warmup iterations (burn-in).
Implementation
The function uses the No-U-Turn Sampler (NUTS; Hoffman and Gelman, 2014) implemented in the Mamba.jl package to generate a random sample from the posterior distribution.
Currently, only the improper uniform prior is implemented, i.e.
\[f_{(β₁,β₂,β₃)}(β₁,β₂,β₃) ∝ 1,\]
where
\[μ = X₁ × β₁,\]
\[ϕ = X₂ × β₂,\]
\[ξ = X₃ × β₃.\]
In the stationary case, this improper prior yields to a proper posterior if the sample size is larger than 3 (Northrop and Attalides, 2016).
The covariates are standardized before estimating the parameters to help fit the model. They are transformed back on their original scales before returning the fitted model.
See also gevfitbayes
for the other methods, gevfitpwm
, gevfit
and BlockMaxima
.
References
Hoffman M. D. and Gelman A. (2014). The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15:1593–1623.
Paul J. Northrop P. J. and Attalides N. (2016). Posterior propriety in Bayesian extreme value analyses using reference priors. Statistica Sinica, 26:721-743.
Extremes.gevfitbayes
— Methodgevfitbayes(model::BlockMaxima{GeneralizedExtremeValue};
niter::Int=5000,
warmup::Int=2000)
Generate a sample from the BlockMaxima
model parameters' posterior distribution.
Extremes.gevfitbayes
— Methodgevfitbayes(df::DataFrame,
datacol::Symbol,
locationcovid = Vector{Symbol}(),
logscalecovid = Vector{Symbol}(),
shapecovid = Vector{Symbol}(),
niter::Int=5000,
warmup::Int=2000)
Generate a sample from the GEV parameters' posterior distribution.
Arguments
df::DataFrame
: The dataframe containing the data.datacol::Symbol
: The symbol of the column ofdf
containing the block maxima data.locationcovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the location parameter.logscalecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the log-scale parameter.shapecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the shape parameter.
Extremes.gevfitbayes
— Methodgevfitbayes(y,
locationcov = Vector{Variable}(),
logscalecov = Vector{Variable}(),
shapecov = Vector{Variable}(),
niter::Int=5000,
warmup::Int=2000
)
Generate a sample from the GEV parameters' posterior distribution.
Arguments
y::Vector{<:Real}
: The vector of block maxima.locationcov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the location parameter.logscalecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the log-scale parameter.shapecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the shape parameter.
Extremes.gumbelfitbayes
— Functiongumbelfitbayes(..., niter::Int=5000, warmup::Int=2000)
Generate a sample from the Gumbel parameters' posterior distribution.
Arguments
niter::Int = 5000
: The total number of MCMC iterations.warmup::Int = 2000
: The number of warmup iterations (burn-in).
Implementation
The function uses the No-U-Turn Sampler (NUTS; Hoffman and Gelman, 2014) implemented in the Mamba.jl package to generate a random sample from the posterior distribution.
Currently, only the improper uniform prior is implemented, i.e.
\[f_{(β₁,β₂,β₃)}(β₁,β₂,β₃) ∝ 1,\]
where
\[μ = X₁ × β₁,\]
\[ϕ = X₂ × β₂,\]
In the stationary case, this improper prior yields to a proper posterior if the sample size is larger than 3 (Northrop and Attalides, 2016).
The covariates are standardized before estimating the parameters to help fit the model. They are transformed back on their original scales before returning the fitted model.
See also gevfitbayes
for the other methods and BlockMaxima
.
References
Hoffman M. D. and Gelman A. (2014). The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15:1593–1623.
Paul J. Northrop P. J. and Attalides N. (2016). Posterior propriety in Bayesian extreme value analyses using reference priors. Statistica Sinica, 26:721-743.
Extremes.gumbelfitbayes
— Methodgumbelfitbayes(model::BlockMaxima{Gumbel};
niter::Int=5000,
warmup::Int=2000)
Generate a sample from the BlockMaxima
model parameters' posterior distribution.
Extremes.gumbelfitbayes
— Methodgumbelfitbayes(df::DataFrame,
datacol::Symbol,
locationcovid = Vector{Symbol}(),
logscalecovid = Vector{Symbol}(),
niter::Int=5000,
warmup::Int=2000)
Generate a sample from the Gumbel parameters' posterior distribution.
Arguments
df::DataFrame
: The dataframe containing the data.datacol::Symbol
: The symbol of the column ofdf
containing the block maxima data.locationcovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the location parameter.logscalecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the log-scale parameter.
Extremes.gumbelfitbayes
— Methodgumbelfitbayes(y,
locationcov = Vector{Variable}(),
logscalecov = Vector{Variable}(),
niter::Int=5000,
warmup::Int=2000
)
Generate a sample from the Gumbel parameters' posterior distribution.
Arguments
y::Vector{<:Real}
: The vector of block maxima.locationcov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the location parameter.logscalecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the log-scale parameter.
Extremes.gpfitbayes
— Functiongpfitbayes(..., niter::Int=5000, warmup::Int=2000)
Generate a sample from the GP parameters' posterior distribution.
Data provided must be the exceedances above the threshold, i.e. the data above the threshold minus the threshold.
Arguments
niter::Int = 5000
: The total number of MCMC iterationswarmup::Int = 2000
: The number of warmup iterations (burn-in).
Implementation
The function uses the No-U-Turn Sampler (NUTS; Hoffman and Gelman, 2014) implemented in the Mamba.jl package to generate a random sample from the posterior distribution.
Currently, only the improper uniform prior is implemented, i.e.
\[f_{(β₂,β₃)}(β₂,β₃) ∝ 1,\]
where
\[ϕ = X₂ × β₂,\]
\[ξ = X₃ × β₃.\]
In the stationary case, this improper prior yields to a proper posterior if the sample size is larger than 2 (Northrop and Attalides, 2016).
The covariates are standardized before estimating the parameters to help fit the model. They are transformed back on their original scales before returning the fitted model.
See also gpfitbayes
for the other methods, gpfitpwm
, gpfit
and ThresholdExceedance
.
Reference
Hoffman M. D. and Gelman A. (2014). The No-U-Turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15:1593–1623.
Paul J. Northrop P. J. and Attalides N. (2016). Posterior propriety in Bayesian extreme value analyses using reference priors. Statistica Sinica, 26:721-743.
Extremes.gpfitbayes
— Methodgpfitbayes(df::DataFrame,
datacol::Symbol,
logscalecovid = Vector{Symbol}(),
shapecovid = Vector{Symbol}(),
niter::Int=5000,
warmup::Int=2000)
Generate a sample from the GP parameters' posterior distribution.
Arguments
df::DataFrame
: The dataframe containing the data.datacol::Symbol
: The symbol of the column ofdf
containing the exceedances.logscalecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the log-scale parameter.shapecovid::Vector{Symbol} = Vector{Symbol}()
: The symbols of the columns ofdf
containing the covariates of the shape parameter.
Extremes.gpfitbayes
— Methodgpfitbayes(model::ThresholdExceedance;
niter::Int=5000,
warmup::Int=2000)
Generate a sample from the GP parameters' posterior distribution.
Extremes.gpfitbayes
— Methodgpfitbayes(y,
logscalecov = Vector{Variable}(),
shapecov = Vector{Variable}(),
niter::Int=5000,
warmup::Int=2000
)
Generate a sample from the GP parameters' posterior distribution.
Arguments
y::Vector{<:Real}
: The vector of exceedances.logscalecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the log-scale parameter.shapecov::Vector{<:DataItem} = Vector{Variable}()
: The covariates of the shape parameter.
Methods on fitted models
Extremes.getcluster
— Methodgetcluster(y::Vector{<:Real}, u₁::Real, u₂::Real)
Extract the clusters from vector y
.
A cluster is defined as a sequence of values higher than threshold u₂ with at least a value higher than threshold u₁.
See also Cluster
.
Extremes.getcluster
— Methodgetcluster(y::Vector{<:Real}, u::Real; runlength::Int=1)::Vector{Cluster}
Extract the clusters from vector y
.
Threshold exceedances separated by fewer than r non-exceedances belong to the same cluster. The value r is corresponds to the runlength parameter. This approach is referred to as the runs declustering scheme (see Coles, 2001 sec. 5.3.2).
See also Cluster
.
Distributions.location
— Methodlocation(fm::AbstractFittedExtremeValueModel)
Return the location parameters of the fitted model.
Distributions.scale
— Methodscale(fm::AbstractFittedExtremeValueModel)
Return the scale parameters of the fitted model.
Distributions.shape
— Methodshape(fm::AbstractFittedExtremeValueModel)
Return the shape parameters of the fitted model.
Extremes.cint
— Functioncint(..., confidencelevel::Real=.95)
Compute confidence interval or credible interval in the case of Bayesian estimation.
The function can be applied on any AbstractFittedExtremeValueModel
subtype to obtain a confidence interval on the model parameters. It can also be applied on ReturnLevel
type to obtain a confidence interval on the return level.
Implementation
The method used for computing the interval depends on the estimation method. In the case of maximum likelihood estimation, the confidence intervals are computed using the Wald approximation based on the approximate parameter estimates covariance matrix. In the case of Bayesian estimation, the return interval is the highest posterior density estimate based on the MCMC sample. In the case of probability weighted moment estimation, the intervals are computed using a boostrap procedure.
StatsAPI.params
— Methodparams(fm::AbstractFittedExtremeValueModel)
Return the parameters of the fitted model.
Extremes.parametervar
— Methodparametervar(fm::BayesianAbstractExtremeValueModel)::Array{Float64, 2}
Compute the covariance parameters estimate of the fitted model fm
.
Extremes.returnlevel
— Methodreturnlevel(fm::BayesianAbstractExtremeValueModel{ThresholdExceedance}, threshold::Real, nobservation::Int,
nobsperblock::Int, returnPeriod::Real)::ReturnLevel
Compute the return level corresponding to the return period returnPeriod
from the fitted model fm
.
The threshold should be a scalar. A varying threshold is not yet implemented.
Extremes.returnlevel
— Methodreturnlevel(fm::BayesianAbstractExtremeValueModel{BlockMaxima}, returnPeriod::Real)::ReturnLevel
Compute the return level corresponding to the return period returnPeriod
from the fitted model fm
.
Extremes.aic
— Methodaic(fm:::MaximumLikelihoodAbstractExtremeValueModel)
Compute the Akaike information criterion (AIC) of the fitted model by maximum likelihood method.
Details
The AIC is defined as follows:
$AIC = 2 k - 2 \log \hat{L};$
where $k$ is the number of estimated parameters and $\hat{L}$ is the maximized value of the likelihood function for the model.
Extremes.bic
— Methodbic(fm:::MaximumLikelihoodAbstractExtremeValueModel)
Compute the Bayesian information criterion (BIC) of the fitted model by maximum likelihood method.
Details
The BIC is defined as follows:
$BIC = k \log n - 2 \log \hat{L};$
where $k$ is the number of estimated parameters, $n$ is the number of data and $\hat{L}$ is the maximized value of the likelihood function for the model.
Extremes.parametervar
— Methodparametervar(fm::MaximumLikelihoodAbstractExtremeValueModel)::Array{Float64, 2}
Compute the covariance parameters estimate of the fitted model fm
.
Extremes.returnlevel
— Methodreturnlevel(fm::MaximumLikelihoodAbstractExtremeValueModel{ThresholdExceedance}, threshold::Real, nobservation::Int,
nobsperblock::Int, returnPeriod::Real)::ReturnLevel
Compute the return level corresponding to the return period returnPeriod
from the fitted model fm
.
The threshold should be a scalar. A varying threshold is not yet implemented.
Extremes.returnlevel
— Methodreturnlevel(fm::MaximumLikelihoodAbstractExtremeValueModel{BlockMaxima}, returnPeriod::Real)::ReturnLevel
Compute the return level corresponding to the return period returnPeriod
from the fitted model fm
.
Extremes.parametervar
— Functionparametervar(fm::pwmAbstractExtremeValueModel, nboot::Int=1000)
Estimate the parameter estimates covariance matrix by bootstrap.
Extremes.returnlevel
— Methodreturnlevel(fm::pwmAbstractExtremeValueModel{ThresholdExceedance, T} where T<:Distribution, threshold::Real, nobservation::Int,
nobsperblock::Int, returnPeriod::Real)::ReturnLevel
Compute the return level corresponding to the return period returnPeriod
from the fitted model fm
.
The threshold should be a scalar. A varying threshold is not yet implemented.
Extremes.returnlevel
— Methodreturnlevel(fm::pwmAbstractExtremeValueModel{BlockMaxima, T} where T<:Distribution, returnPeriod::Real)::ReturnLevel
Compute the confidence intervel for the return level corresponding to the return period returnPeriod
from the fitted model fm
with confidence level confidencelevel
.
Diagnostic plots
Extremes.diagnosticplots
— Methoddiagnosticplots(fm::AbstractFittedExtremeValueModel)
Diagnostic plots
Extremes.histplot
— Methodhistplot(fm::AbstractFittedExtremeValueModel)
Histogram plot
Extremes.mrlplot
— FunctionExtremes.probplot
— Methodprobplot(fm::AbstractFittedExtremeValueModel)
Probability plot
Extremes.qqplot
— MethodExtremes.qqplotci
— Functionqqplotci(fm::AbstractFittedExtremeValueModel, α::Real=.05)
Quantile-Quantile plot along with the confidence/credible interval of level 1-α
.
Note
This function is currently only available for stationary models.
See also returnlevelplotci
and qqplot
.
Example
using Distributions, Extremes
pd = GeneralizedExtremeValue(0,1,0)
y = rand(pd, 300)
fm = gevfit(y)
qqplotci(fm)
Extremes.returnlevelplot
— Methodreturnlevelplot(fm::AbstractFittedExtremeValueModel)
Return level plot
Extremes.returnlevelplotci
— Functionreturnlevelplotci(fm::AbstractFittedExtremeValueModel, α::Real=.05)
Return level plot along with the confidence/credible interval of level 1-α
.
Note
This function is currently only available for stationary models.
See also returnlevelplotci
and qqplot
.
Example
using Distributions, Extremes
pd = GeneralizedExtremeValue(0,1,0)
y = rand(pd, 300)
fm = gevfit(y)
returnlevelplotci(fm)
Extremes.mrlplot_data
— Functionmrlplot_data(y::Vector{<:Real}, steps::Int = 100)::DataFrame
Compute the mean residual life from vector y
.
The set of thresholds ranges from minimum(y)
to the second-to-last larger value in steps
number of steps.
Extremes.probplot_data
— Functionprobplot_data(fm::fittedModel)
Return the probability plot data in a DataFrame.
Extremes.qqplot_data
— Functionqqplot_data(fm::fittedModel)
Return the quantile-quantile plot data in a DataFrame.
Extremes.returnlevelplot_data
— Functionreturnlevelplot_data(fm::fittedModel)
Return the return level plot data in a DataFrame.
Types
Extremes.AbstractExtremeValueModel
— TypeAbstractExtremeValueModel
Abstract type containing the extreme value model types.
- BlockMaxima
- ThresholdExceedance
Extremes.AbstractFittedExtremeValueModel
— TypeAbstractFittedExtremeValueModel{T<:AbstractExtremeValueModel}
Abstract type containing the fitted extreme value model types.
- BayesianAbstractExtremeValueModel
- MaximumLikelihoodAbstractExtremeValueModel
- pwmAbstractExtremeValueModel
Extremes.BlockMaxima
— MethodBlockMaxima{GeneralizedExtremeValue}(data::Vector{<:Real};
locationcov::Vector{Variable} = Vector{Variable}(),
logscalecov::Vector{Variable} = Vector{Variable}(),
shapecov::Vector{Variable} = Vector{Variable}())::BlockMaxima
Creates a BlockMaxima structure.
Extremes.BlockMaxima
— MethodBlockMaxima{Gumbel}(data::Vector{<:Real};
locationcov::Vector{Variable} = Vector{Variable}(),
logscalecov::Vector{Variable} = Vector{Variable}())::BlockMaxima
Creates a BlockMaxima{Gumbel} structure.
Extremes.Cluster
— TypeCluster(u₁::Real,u₂::Real,position::Vector{<:Int},value::Vector{<:Real})
Cluster type.
Extremes.Flat
— TypeFlat()
Construct a Flat <: ContinuousUnivariateDistribution object representing an improper uniform distribution on the real line.
Extremes.ReturnLevel
— TypeReturnLevel
ReturnLevel type constructed by the function returnlevel
.
Extremes.ThresholdExceedance
— MethodThresholdExceedance(exceedances::Vector{<:Real};
logscalecov::Vector{<:DataItem} = Vector{Variable}(),
shapecov::Vector{<:DataItem} = Vector{Variable}())::ThresholdExceedance
Creates a ThresholdExceedance structure.
Extremes.Variable
— TypeVariable(name::String, value :: Vector{<:Real})
Construct a Variable type
Extremes.VariableStd
— MethodVariableStd(name::String, z::Vector{<:Real})::VariableStd
Construct a VariableStd type from the standardized vector z
with the name name
.