Package spd. R topics documented: August 29, Type Package Title Semi Parametric Distribution Version Date

Similar documents
Package fextremes. February 14, 2012

Package fextremes. November 17, 2017

Package gpdtest. February 19, 2015

Package FCGR. October 13, 2015

Package fcopulae. November 16, 2017

Package GLDreg. February 28, 2017

Package seg. February 15, 2013

Package OutlierDC. R topics documented: February 19, 2015

Package ercv. July 17, 2017

Package munfold. R topics documented: February 8, Type Package. Title Metric Unfolding. Version Date Author Martin Elff

Package MeanShift. R topics documented: August 29, 2016

Use of Extreme Value Statistics in Modeling Biometric Systems

Package benchden. February 19, 2015

Package seg. September 8, 2013

Package kdevine. May 19, 2017

Package r2d2. February 20, 2015

Package cgh. R topics documented: February 19, 2015

Package OutlierDM. R topics documented: February 19, 2015

Package beanplot. R topics documented: February 19, Type Package

Package gridgraphics

Package distrrmetrics

Package sure. September 19, 2017

Package Grid2Polygons

The nor1mix Package. August 3, 2006

Package glogis. R topics documented: March 16, Version Date

Package extremevalues

Package R2SWF. R topics documented: February 15, Version 0.4. Title Convert R Graphics to Flash Animations. Date

Package feature. R topics documented: July 8, Version Date 2013/07/08

Package coga. May 8, 2018

Package areaplot. October 18, 2017

Package vinereg. August 10, 2018

The nor1mix Package. June 12, 2007

Package SCBmeanfd. December 27, 2016

Package vines. July 28, 2016

Package GenKern. R topics documented: February 19, Version Date 10/11/2013

Package CINID. February 19, 2015

Package JBTools. R topics documented: June 2, 2015

Package sbf. R topics documented: February 20, Type Package Title Smooth Backfitting Version Date Author A. Arcagni, L.

Package feature. R topics documented: October 26, Version Date

Package fbroc. August 29, 2016

Package JOP. February 19, 2015

Package orthogonalsplinebasis

Application of the Peaks-Over-Threshold Method on Insurance Data

Package GCAI.bias. February 19, 2015

Package splines2. June 14, 2018

Package truncgof. R topics documented: February 20, 2015

Package pairsd3. R topics documented: August 29, Title D3 Scatterplot Matrices Version 0.1.0

Package MCMC4Extremes

Package fitur. March 11, 2018

Package spcadjust. September 29, 2016

Package SFtools. June 28, 2017

Package mixphm. July 23, 2015

Package mlegp. April 15, 2018

Package CONOR. August 29, 2013

Package qboxplot. November 12, qboxplot... 1 qboxplot.stats Index 5. Quantile-Based Boxplots

Package pendvine. R topics documented: July 9, Type Package

Package CLA. February 6, 2018

Package SiZer. February 19, 2015

Package cumseg. February 19, 2015

Package sspline. R topics documented: February 20, 2015

Package libstabler. June 1, 2017

Package genelistpie. February 19, 2015

Package dyncorr. R topics documented: December 10, Title Dynamic Correlation Package Version Date

Package procoil. R topics documented: April 10, Type Package

Package Numero. November 24, 2018

Package ParetoPosStable

Package qicharts. October 7, 2014

Package smoothr. April 4, 2018

Package gsscopu. R topics documented: July 2, Version Date

Package nplr. August 1, 2015

Package smoother. April 16, 2015

The monoproc Package

Package Mondrian. R topics documented: March 4, Type Package

Package Density.T.HoldOut

The GSM Package. August 9, 2007

Package evmix. February 9, 2018

Package logitnorm. R topics documented: February 20, 2015

Package Conake. R topics documented: March 1, 2015

Package lmesplines. R topics documented: February 20, Version

Package tseriesentropy

Package CausalImpact

Package OLScurve. August 29, 2016

Package CoImp. August 8, 2016

Package gains. September 12, 2017

Package MicroStrategyR

Package imgur. R topics documented: December 20, Type Package. Title Share plots using the imgur.com image hosting service. Version 0.1.

Package ICSOutlier. February 3, 2018

Package weco. May 4, 2018

Package flowdensity. June 28, 2018

Package synchronicity

Package oasis. February 21, 2018

Package spatialtaildep

Package arulesnbminer

Package EnQuireR. R topics documented: February 19, Type Package Title A package dedicated to questionnaires Version 0.

Package osrm. November 13, 2017

Package penrvine. R topics documented: May 21, Type Package

Package iosmooth. R topics documented: February 20, 2015

Package ipft. January 4, 2018

Package bayesdp. July 10, 2018

Package SCVA. June 1, 2017

Transcription:

Type Package Title Semi Parametric Distribution Version 2.0-1 Date 2015-07-02 Package spd August 29, 2016 Author Alexios Ghalanos <alexios@4dscape.com> Maintainer Alexios Ghalanos <alexios@4dscape.com> The Semi Parametric Piecewise Distribution blends the Generalized Pareto Distribution for the tails with a kernel based interior. Collate misc-spd.r classes-spd.r methods-gpd.r methods-spdfit.r methods-spddistribution.r methods-spdplots.r Depends methods Imports KernSmooth, stats, graphics, utils LazyLoad yes URL http://www.unstarched.net, https://bitbucket.org/alexiosg License GPL NeedsCompilation no Repository CRAN Date/Publication 2015-07-03 05:44:57 R topics documented: spd-package......................................... 2 GPDFIT-class........................................ 3 GPDTAILS-class...................................... 4 plot-methods........................................ 5 SPD-class.......................................... 5 spd-methods......................................... 6 spdfit-methods........................................ 8 Index 10 1

2 spd-package spd-package The Semi-Parametric Distribution (spd) package Details 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. The package implements fit, distribution, density, quantile and random number generation. Currently, only the generalized pareto distribution is implemented for modelling the tails, but the package can easily be extended. Package: spd Type: Package Version: 2.0-0 Date: 2013-12-15 License: GPL LazyLoad: yes Depends: methods The main functionality of the package is contained in the SPD class, created by calling spdfit. 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 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. Author(s) Alec Stephenson for the functions from R\ s "evd-package", Alec Stephenson for the functions from R\ s "evir-package", Alexander McNeil for the EVIS functions underlying the "evir-package", Diethelm Wuertz for the functions from R\ s "fextremes-package", M.P.Wand and M.C.Jones for the functions from R\ s "KernSmooth-package", Alexios Ghalanos for this package. References Carmona, R. and J. Morrisson (2001). Heavy Tails and Copulas with Evanesce, ORFE Tech. Report, Princeton University Carmona, R. (2001). Statistical Analysis of Financial Data, with an implementation in Splus Embrechts, P., Klueppelberg, C., Mikosch, T. (1997); Modelling Extremal Events, Springer

GPDFIT-class 3 Examples ## Not run: library(mass) x<-sp500/100 fit<-spdfit(x) show(fit) ## End(Not run) GPDFIT-class Class: Generalized Pareto Distribution Locally implemented and slightly modified class for the generalized pareto distribution (gpd) fit, borrowed from package fextremes. Created on modelling the tails of the data by spdfit Objects from the Class Objects of this class cannot be created by user as the methods are not exported. Slots call: Object of class "call" method: Object of class "character" parameter: Object of class "list" data: Object of class "list" fit: Object of class "list" residuals: Object of class "numeric" title: Object of class "character" description: Object of class "character" Note S3 plot method exists which provides for visual inspection of the fit and is called by the higher level S3 plot method of the SPD class Author(s) Alec Stephenson for the functions from R\ s "evd-package", Alec Stephenson for the functions from R\ s "evir-package", Alexander McNeil for the EVIS functions underlying the "evir-package", Diethelm Wuertz for the functions from R\ s "fextremes-package", M.P.Wand and M.C.Jones for the functions from R\ s "KernSmooth-package", Alexios Ghalanos for this package.

4 GPDTAILS-class References Carmona, R. and J. Morrisson (2001). Heavy Tails and Copulas with Evanesce, ORFE Tech. Report, Princeton University Carmona, R. (2001). Statistical Analysis of Financial Data, with an implementation in Splus Embrechts, P., Klueppelberg, C., Mikosch, T. (1997); Modelling Extremal Events, Springer GPDTAILS-class Class: GPDTAILS Class: SPD with Generalized Pareto Distribution (GPD) Tails Objects from the Class Slots Objects can be created by calling spdfit. The main implemented class of the spd package holding the details of the fitted object with gpd tails. Extends call:... method: the gpd fitting method kernel: the kernel type data: the original dataset threshold: the upper and lower thresholds fitted ptails: the upper and lower cutoff points. fit: the upper and lower gpd fit and the interior kernel fit objects. title: optional title of project description: optional description Class SPD, directly. Author(s) Alexios Ghalanos References Carmona, R. and J. Morrisson (2001). Heavy Tails and Copulas with Evanesce, ORFE Tech. Report, Princeton University Carmona, R. (2001). Statistical Analysis of Financial Data, with an implementation in Splus

plot-methods 5 plot-methods Method: Plotting (S4) for implemented S4 classes Locally implemented and modified methods for plotting the fit of the GPDFIT object (taken from package fextremes), and the overall fit of the GPDTAILS object. Usage plot(x,y,...) Arguments x y An object of class GPDFIT or GPDTAILS. missing... [which] - Valid arguments are ask for interactive plotting, all to plot all or a number from 1 to 6 indicating the desired charts to plot. Examples ## Not run: library(mass) x<-sp500/100 fit<-spdfit(x) plot(fit,which=1) # this in fact exctracts the GPDFIT object (from GPDTAILS) for which plot # methods exist. plot(fit,which=3) ## End(Not run) SPD-class Class: Semi-Parametric Distribution Virtual Class for holding the tail fit and kernel interior objects.

6 spd-methods Methods dspd signature(x = "numeric", fit = "SPD", linear = "logical"): density function pspd signature(q = "numeric", fit = "SPD", linear = "logical"): distribution function qspd signature(p = "numeric", fit = "SPD", linear = "logical"): quantile function rspd signature(n = "numeric", fit = "SPD", linear = "logical"): random number generation function show signature(object = "SPD"): show method Objects from the Class A virtual Class: No objects may be created from it. Author(s) Alexios Ghalanos References Carmona, R. and J. Morrisson (2001). Heavy Tails and Copulas with Evanesce, ORFE Tech. Report, Princeton University Carmona, R. (2001). Statistical Analysis of Financial Data, with an implementation in Splus Examples showclass("spd") spd-methods Method: Semi-Parametric Distribution Density, Distribution, Quantile and Random Number Generation methods for the Semi-Parametric Distribution. Usage dspd(x, fit, linear) pspd(q, fit, linear) qspd(p, fit, linear) rspd(n, fit, linear)

spd-methods 7 Arguments n [rspd] - the number of random deviates to be generated from fitted distribution. p Value Note a vector of probability levels, the desired probability for the quantile estimate (e.g. 0.99 for the 99th percentile). x,q [pspd,dspd] - a numeric vector of quantiles. fit [all] - the object of class SPDFIT created by calling the spdfit function. linear [all] - logical, if TRUE interior smoothing function uses linear interpolation rather than constant. All values are numeric vectors: d* returns the density (pdf), p* returns the probability (cdf), q* returns the quantiles (inverse cdf), and r* generates random deviates. 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. Interpolation is used to splice together the ends with the middle portion, providing for an approximate piecewise constant density function. As such, caution should be used when interpreting results obtained by use of this function. Author(s) Alec Stephenson for the functions from R\ s evd package, Alec Stephenson for the functions from R\ s evir package, Alexander McNeil for the EVIS functions underlying the evir package, Diethelm Wuetrz for the fextremes Implementation of the gpd, Alexios Ghalanos for the SPD Implementation, References Embrechts, P., Klueppelberg, C., Mikosch, T. (1997); Modelling Extremal Events, Springer. Carmona, R. (2004);Statistical Anlaysis of Financial Data in Splus, Springer. Examples ## Not run: library(mass) x = SP500/100 fit=spdfit(x, upper=0.9, lower=0.1)

8 spdfit-methods ## rspd - par(mfrow = c(2, 2), cex = 0.7) r = rspd(n = 1000, fit) hist(r, n = 100, probability = TRUE, xlab = "r", col = "steelblue", border = "white",main = "Density") box() ## dspd - # Plot empirical density and compare with true density: r = rspd(n = 1000, fit) hist(r, n = 100, probability = TRUE, xlab = "r", col = "steelblue", border = "white",main = "Density") box() x = seq(-0.3, 0.3, length.out = 1000) lines(x, dspd(x, fit), col = "darkorange",lwd=2) ## pspd - # Plot df and compare with true df: plot(sort(r), (1:length(r)/length(r)), ylim = c(0, 1), pch = 19, cex = 0.5, ylab = "p", xlab = "q", main = "CDF") grid() q = seq(-0.3, 0.3, length.out = 1000) lines(q, pspd(q, fit), col = "darkorange",lwd=2) ## End(Not run) spdfit-methods Method: Fitting the Semi-Parametric Distribution Usage The semi-parametric distribution fitting method. spdfit(data, upper = 0.9, lower = 0.1, tailfit="gpd", type = c("mle", "pwm"), kernelfit = c("normal", "box", "epanech", "biweight", "triweight"), information = c("observed", "expected"), title = NULL, description = NULL,...) Arguments data upper lower tailfit type An object coercible to a matrix. Upper tail cutoff for fitting the generalized pareto or other distribution. Lower tail cutoff for fitting the generalized pareto or other distribution. Distribution to Use for fitting the tails. A character string selecting the desired estimation method, either "mle" for the maximum likelihood method or "pwm" for the probability weighted moment method. By default, the first will be selected.

spdfit-methods 9 Value kernelfit information title description Type of kernel to fit to the interior of the distribution. Whether tail distribution standard errors should be calculated with "observed" or "expected" information. This only applies to the maximum likelihood method; for the probability-weighted moments method "expected" information is used if possible. A character string which allows for a project title. A character string which allows for a brief description.... Control parameters and plot parameters optionally passed to the optimization and/or plot function. Parameters for the optimization function are passed to components of the control argument of optim. Returns an object of class SPD. Examples ## Not run: library(mass) x<-sp500/100 fit<-spdfit(x) show(fit) #plot(fit,which="all") ## End(Not run)

Index Topic classes GPDFIT-class, 3 GPDTAILS-class, 4 SPD-class, 5 Topic distribution spd-methods, 6 Topic methods plot-methods, 5 spdfit-methods, 8 dspd, 2 dspd dspd,any,any,any-method dspd,vector,spd,logical-method dspd,vector,spd,missing-method dspd-methods GPDFIT, 5 GPDFIT (GPDFIT-class), 3 GPDFIT-class, 3 GPDTAILS, 5 GPDTAILS (GPDTAILS-class), 4 GPDTAILS-class, 4 plot (plot-methods), 5 plot,any,any-method (plot-methods), 5 plot,gpdfit,missing-method (plot-methods), 5 plot,gpdtails,missing-method (plot-methods), 5 plot-methods, 5 pspd, 2 pspd pspd,any,any,any-method pspd,vector,spd,logical-method pspd,vector,spd,missing-method pspd-methods qspd, 2 qspd qspd,any,any,any-method qspd,vector,spd,logical-method qspd,vector,spd,missing-method qspd-methods rspd, 2 rspd rspd,any,any,any-method rspd,vector,spd,logical-method rspd,vector,spd,missing-method rspd-methods show,gpdfit-method (GPDFIT-class), 3 show,spd-method (SPD-class), 5 SPD, 2 4, 9 SPD (SPD-class), 5 spd (spd-package), 2 SPD-class, 5 spd-methods, 6 spd-package, 2 spdfit, 2 4 spdfit (spdfit-methods), 8 spdfit,any-method (spdfit-methods), 8 spdfit-methods, 8 10