sentiv.curve | R Documentation |
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
.
sentiv.curve(f, x, method=c("bootstrap", "polynomial", "none"),
data=NULL, para=NULL, ...)
f |
The nonexceedance probability |
x |
The |
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 |
para |
A distribution parameter list from a function such as |
... |
Additional arguments to pass either to the |
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.
An R list
is returned.
curve |
The value for |
curve.perchg |
The percent change sensitivity curve by |
Tnp1 |
The values for |
Tn |
The value (singular) for |
color |
The curve potentially passes through a zero depending on the values for |
EX |
The values for the internal variable |
source |
An attribute identifying the computational source of the sensitivity curve: “sentiv.curve”. |
W.H. Asquith
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.
expect.max.ostat
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.