Last chance! 50% off unlimited learning
Sale ends in
Density, cumulative distribution function, quantile function and
random number generation for the extreme value mixture model with P-splines density estimate for bulk
distribution upto the threshold and conditional GPD above threshold. The parameters
are the B-spline coefficients beta
(and associated features), threshold u
GPD scale sigmau
and shape xi
and tail fraction phiu
.
dpsdengpd(x, beta = NULL, nbinwidth = NULL, xrange = NULL,
nseg = 10, degree = 3, u = NULL, sigmau = NULL, xi = 0,
phiu = TRUE, design.knots = NULL, log = FALSE)ppsdengpd(q, beta = NULL, nbinwidth = NULL, xrange = NULL,
nseg = 10, degree = 3, u = NULL, sigmau = NULL, xi = 0,
phiu = TRUE, design.knots = NULL, lower.tail = TRUE)
qpsdengpd(p, beta = NULL, nbinwidth = NULL, xrange = NULL,
nseg = 10, degree = 3, u = NULL, sigmau = NULL, xi = 0,
phiu = TRUE, design.knots = NULL, lower.tail = TRUE)
rpsdengpd(n = 1, beta = NULL, nbinwidth = NULL, xrange = NULL,
nseg = 10, degree = 3, u = NULL, sigmau = NULL, xi = 0,
phiu = TRUE, design.knots = NULL)
quantiles
vector of B-spline coefficients (required)
scaling to convert count frequency into proper density
vector of minimum and maximum of B-spline (support of density)
number of segments between knots
degree of B-splines (0 is constant, 1 is linear, etc.)
threshold
scale parameter (positive)
shape parameter
probability of being above threshold TRUE
spline knots for splineDesign function
logical, if TRUE then log density
quantiles
logical, if FALSE then upper tail probabilities
cumulative probabilities
sample size (positive integer)
dpsdengpd
gives the density,
ppsdengpd
gives the cumulative distribution function,
qpsdengpd
gives the quantile function and
rpsdengpd
gives a random sample.
Extreme value mixture model combining P-splines density estimate for the bulk below the threshold and GPD for upper tail.
The user can pre-specify phiu
permitting a parameterised value for the tail fraction phiu=TRUE
the tail fraction is estimated as the tail fraction from the
KDE bulk model.
The cumulative distribution function with tail fraction phiu=TRUE
), upto the
threshold
The cumulative distribution function for pre-specified
See gpd
for details of GPD upper tail component.
The specification of the underlying B-splines and the P-splines density estimator
are discussed in the psden
function help.
http://en.wikipedia.org/wiki/B-spline
http://statweb.lsu.edu/faculty/marx/
http://en.wikipedia.org/wiki/Generalized_Pareto_distribution
Scarrott, C.J. and MacDonald, A. (2012). A review of extreme value threshold estimation and uncertainty quantification. REVSTAT - Statistical Journal 10(1), 33-59. Available from http://www.ine.pt/revstat/pdf/rs120102.pdf
Eilers, P.H.C. and Marx, B.D. (1996). Flexible smoothing with B-splines and penalties. Statistical Science 11(2), 89-121.
Other psden: fpsdengpd
, fpsden
,
psden
Other psdengpd: fpsdengpd
,
psden
Other fpsdengpd: fpsdengpd
# NOT RUN {
set.seed(1)
par(mfrow = c(1, 1))
x = rnorm(1000)
xx = seq(-6, 6, 0.01)
y = dnorm(xx)
# Plenty of histogram bins (100)
breaks = seq(-4, 4, length.out=101)
# P-spline fitting with cubic B-splines, 2nd order penalty and 8 internal segments
# CV search for penalty coefficient.
fit = fpsdengpd(x, lambdaseq = 10^seq(-5, 5, 0.25), breaks = breaks,
xrange = c(-4, 4), nseg = 10, degree = 3, ord = 2)
hist(x, freq = FALSE, breaks = seq(-4, 4, length.out=101), xlim = c(-6, 6))
# P-splines only
with(fit, lines(xx, dpsden(xx, beta, nbinwidth, design = design.knots), lwd = 2, col = "blue"))
# P-splines+GPD
with(fit, lines(xx, dpsdengpd(xx, beta, nbinwidth, design = design.knots,
u = u, sigmau = sigmau, xi = xi, phiu = phiu), lwd = 2, col = "red"))
abline(v = fit$u, col = "red")
legend("topleft", c("True Density","P-spline density", "P-spline+GPD"),
col=c("black", "blue", "red"), lty = 1)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab