sentiv.curve: Compute the Sensitivity Curve for a Single Quantile

sentiv.curveR Documentation

Compute the Sensitivity Curve for a Single Quantile

Description

The sensitivity curve (SC) is a means to assess how sensitive a particular statistic T_{n+1} for a sample of size n is to an additional sample x to be included. For the implementation by this function, the statistic T is a specific quantile x(F) of interest set by a nonexceedance probability F. The SC is

SC_{n+1}(x,\,| F) = (n+1)(T_{n+1} - T_n)\mbox{,}

where T_n represent the statistic for the sample of size n. The notation here follows that of Hampel (1974, p. 384) concerning n and n+1.

Usage

sentiv.curve(f, x, method=c("bootstrap", "polynomial", "none"),
                   data=NULL, para=NULL, ...)

Arguments

f

The nonexceedance probability F of the quantile for which the sensitivity of its estimation is needed. Only the first value if a vector is given is used and a warning issued.

x

The x values representing the potential one more value to be added to the original data.

data

A vector of mandatory sample data values. These will either be converted to (1) order statistic expectations exact analytical expressions or simulation (backup plan), (2) Bernstein (or similar) polynomials, or (3) the provided values treated as if they are the order statistic expectations.

method

A character variable determining how the statistics T are computed (see Details).

para

A distribution parameter list from a function such as vec2par or lmom2par.

...

Additional arguments to pass either to the lmoms.bootbarvar or to the
dat2bernqua function.

Details

The main features of this function involve how the statistics are computed and are controlled by the method argument. Three different approaches are provided.

Bootstrap: Arguments data and para are mandatory. If boostrap is requested, then the distribution type set by the type attribute in para is used along with the method of L-moments for T(F) estimation. The T_n(F) is directly computed from the distribution in para. And for each x, the T_{n+1}(F) is computed by lmoms, lmom2par, and the distribution type. The sample so fed to lmoms is denoted as c(EX, x).

Polynomial: Argument data is mandatory and para is not used. If polynomial is requested, then the Bernstein polynomial (likely) from the dat2bernqua is used. The T_n(F) is computed by the data sample. And for each x, the T_{n+1}(F) also is computed by dat2bernqua, but the sample so fed to dat2bernqua is denoted as c(EX, x).

None: Arguments data and para are mandatory. If none is requested, then the distribution type set by the type attribute in para is used along with the method of L-moments. The T_n(F) is directly computed from the distribution in para. And for each x, the T_{n+1}(F) is computed by lmoms, lmom2par, and the distribution type. The sample so fed to lmoms is denoted as c(EX, x).

The internal variable EX now requires discussion. If method=none, then the data are sorted and set into the internal variable EX. Conversely, if method=bootstrap or method=polynomial, then EX will contain the expectations of the order statistics from lmoms.bootbarvar.

Lastly, the Weibull plotting positions are used for the probability values for the data as provided by the pp function. Evidently, if method is either parent or polynomial then a “stylized sensitivity curve” would created (David, 1981, p. 165) because the expectations of the sample order statistics and not the sample order statistics (the sorted sample) are used.

Value

An R list is returned.

curve

The value for SC(x) = (n+1)(T_{n+1} - T_n).

curve.perchg

The percent change sensitivity curve by SC^{(\%)}(x) = 100\times (T_{n+1} - T_n)/T_n.

Tnp1

The values for T_{n+1} = T_n + SC(x)/(n+1).

Tn

The value (singular) for T_n which was estimated according to method.

color

The curve potentially passes through a zero depending on the values for x. The color is set to distinquish between negatives and positives so that the user could use the absolute value of curve on logarithmic scales and use the color to distinquish the original negatives.

EX

The values for the internal variable EX.

source

An attribute identifying the computational source of the sensitivity curve: “sentiv.curve”.

Author(s)

W.H. Asquith

References

David, H.A., 1981, Order statistics: John Wiley, New York.

Hampel, F.R., 1974, The influence curve and its role in robust estimation: Journal of the American Statistical Association, v. 69, no. 346, pp. 383–393.

See Also

expect.max.ostat

Examples

## Not run: 
set.seed(50)
mean <- 12530; lscale <- 5033; lskew <- 0.4
n <- 46; type <- "gev"; lmr <- vec2lmom(c(mean,lscale,lskew))
F <- 0.90 # going to explore sensitivity on the 90th percentile
par.p <- lmom2par(lmr, type=type) # Parent distribution
TRUE.Q <- par2qua(F, par.p)
X <- sort(rlmomco(n, par.p)) # Simulate a small sample
par.s <- lmom2par(lmoms(X), type=type) # Now fit the distribution
SIM.Q <- par2qua(F, par.s); SIM.BAR <- par2lmom(par.s)$lambdas[1]
D <- log10(mean) - log10(lscale)
R <- as.integer(log10(mean)) + c(-D, D) # need some x-values to explore
Xs <- 10^(seq(R[1], R[2], by=.01)) # x-values to explore
# Sample estimate are the "parent" only to mimic a more real-world setting.
# where one "knows" the form of the parent but perhaps not the parameters.
SC1 <- sentiv.curve(F, Xs, data=X, para=par.s, method="bootstrap")
SC2 <- sentiv.curve(F, Xs, data=X, para=par.s, method="polynomial",
                              bound.type="Carv")
SC3 <- sentiv.curve(F, Xs, data=X, para=par.s, method="none")
xlim <- range(c(Xs,SC1$Tnp1,SC2$Tnp1,SC3$Tnp1))
ylim <- range(c(SC1$curve.perchg, SC2$curve.perchg, SC3$curve.perchg))
plot(xlim, c(0,0), type="l", lty=2, ylim=ylim, xaxs="i", yaxs="i",
     xlab=paste("Magnitude of next value added to sample of size",n),
     ylab=paste("Percent change fitted",F,"probability quantile"))
mtext(paste("Distribution",par.s$type,"with parameters",
      paste(round(par.s$para, digits=3), collapse=", ")))
lines(rep(TRUE.Q,  2), c(-10,10), lty=4, lwd=3)
lines(rep(SIM.BAR, 2), c(-10,10), lty=3, lwd=2)
lines(rep(SIM.Q,   2), c(-10,10), lty=2)
lines(Xs, SC1$curve.perchg, lwd=3, col=1)
lines(Xs, SC2$curve.perchg, lwd=2, col=2)
lines(Xs, SC3$curve.perchg, lwd=1, col=4)
rug(SC1$Tnp1, col=rgb(0,0,0,0.3))
rug(SC2$Tnp1, col=rgb(1,0,0,0.3))
rug(SC3$Tnp1, col=rgb(0,0,1,0.3), tcl=-.75) #
## End(Not run)

lmomco documentation built on May 29, 2024, 10:06 a.m.