R: Method: Semi-Parametric Distribution
[all] – the object of class SPDFIT created by calling the spdfit function. Methods for density dspd, distribution pspd, quantile qspd and random number generation rspd exist and take 2 main arguments, the input value and the fitted object. The package implements fit, distribution, density, quantile and random number generation. This distribution estimates the tails of the data using the Generalized Pareto distribution (gpd) whilst the interior is estimated using a kernel density.
The spd package uses the „bkde” function from the package KernSmooth for the kernel interior fit, while for the tail fit borrows from the fExtremes package and implements a locally modified copy of the gpd functionality and methods. The main functionality of the package is contained in the SPD class, created by calling spdfit. The Semi-Parametric Distribution is a piecewise distribution constructed by parametrically modelling the tails of the distribution using an appropriate distribution (e.g. generalized pareto) and the interior by kernel methods.
Currently, only the generalized pareto distribution is implemented for modelling the tails, but the package can easily be extended. To calculate expectations from the estimated object we can use quadrature integration, as shown below, with calculations for the mean, variance, skewness, kurtosis, value at risk (1%) and expected shortfall (1%). Interpolation is used to splice together the ends with the middle portion, providing for an approximate piecewise constant density function.
Choosing the correct threshold when applying the Generalized Pareto distribution is an important step to ensure that the asymptotic distribution fits cran.wustl.edu the data well and the parameter estimates are stable. The tails and interior are then smoothly joined together to form the semi-parametric distribution.
We choose reasonably large but finite values for the numerical integration limits. The vertical purple lines show the region modeled by the kernel density, representing the thresholds beyond which the GPD is used. The mev package, which is used for estimating the GPD (except in the case of the probability weighted moments approach) provides threshold stability plots and other diagnostics for aid in choosing the right threshold. There are a number of methods to test for this, and numerous packages in R which can help.
The density is computed using the generalized pareto distribution in the tails, while for the middle, the density is computed by using a smooth gradient approach. [all] – logical, if TRUE interior smoothing function uses linear interpolation rather than constant. A vector of probability levels, the desired probability for the quantile estimate (e.g. 0.99 for the 99th percentile). [rspd] – the number of random deviates to be generated from fitted distribution. Density, Distribution, Quantile and Random Number Generation methods for the Semi-Parametric Distribution. Statistical Analysis of Financial Data, with an implementation in Splus Embrechts, P., Klueppelberg, C., Mikosch, T.