spd-methods: Method: Semi-Parametric Distribution

Description Usage Arguments Value Note Author(s) References Examples

Description

Density, Distribution, Quantile and Random Number Generation methods for the Semi-Parametric Distribution.

Usage

1
2
3
4
dspd(x, fit, linear)
pspd(q, fit, linear)
qspd(p, fit, linear)
rspd(n, fit, linear)

Arguments

n

[rspd] -
the number of random deviates to be generated from fitted distribution.

p

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.

Value

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.

Note

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
library(MASS)
x = SP500/100
fit=spdfit(x, upper=0.9, lower=0.1)
## 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)

spd documentation built on May 2, 2019, 1:51 p.m.