Reverse saddlepoint calculations

DESCRIPTION:

Calculate saddlepoint approximations for a tilted discrete distribution, or solve for the tilting parameter given a desired tail probability. This is an approximation to bootstrap tilting inferences.

Consider a discrete distribution with (possibly equal) probabilities weights on observations L (both vectors of the same length n). Now tilt this distribution using tilting parameter tau, to obtain a new weighted distribution, with probabilities w on observations L; e.g. for exponential tilting w is proportional to exp(tau * L) * weights and for maximum likelihood tilting w is proportional to weights / (1 - tau * L), after L is centered, i.e. L is replaced by (L - mean(L, weights)).

revSaddlepointP returns the saddlepoint estimate of P(Y > Q), where Y is the sample mean of n observations chosen from L with probabilities w and Q is a specified critical value.

revSaddlepointPSolve finds the value of tau (and implicitly finds w) that makes P(Y > Q) = probs.

The internal saddlepoint calculations perform a second round of tilting, finding tau2 or Q so that the weighted mean of L with weights proportional to w * exp(tau2 * L) equals Q. You may supply either tau2 or Q; the default value of Q is the original weighted mean of L.

Either exponential or ML tilting (see ) can be used for the first round of tilting (using tau), but the saddlepoint calculations always use exponential tilting. If the first round uses exponential tilting, and Q is its default, then tau2 = -tau.

USAGE:

revSaddlepointP(     tau,   L, tilt = "exponential", weights = NULL, 
           group = NULL, Q = <<see below>>, tau2 = NULL) 
revSaddlepointPSolve(probs, L, tilt = "exponential", weights = NULL, 
           group = NULL, Q = <<see below>>,  
           initial = NULL, initial.tau2 = NULL, useExpForInit = T, 
           tol = 1E-6, tol.tau = tol, maxiter = 100) 

REQUIRED ARGUMENTS:

tau
vector of tilting parameters.
probs
vector of desired tail probabilities. Must be in the range [0,1].
L
vector of values which determine a discrete distribution. Often these are linear approximation values, produced by or .

OPTIONAL ARGUMENTS:

tilt
character string to indicate which method of tilting: "exponential", or "ml". Default is "exponential" tilting.
weights
vector of probabilities for the discrete distribution; NULL indicates equal probabilities on all observations (the default).
group
vector the same length as the number of rows of L indicating stratified sampling or multiple-group problems; unique values of this vector determine the groups. This is not currently supported for revSaddlepointPSolve with tilt="ml".
Q
scalar; desired critical value. Default is mean(L, weights=weights). Q is ignored if tau2 is supplied.
tau2
vector the same length as tau. By default this is chosen to match the critical value Q.
initial
vector the same length as probs; initial values used in iteratively solving for tau. For tilt = "ml", you must provide both initial and initial.tau2 (or neither).
initial.tau2
vector the same length as probs; initial values used in iteratively solving for tau2. This is used only for tilt="ml", and then only if useExpForInit=F.
useExpForInit
logical value; used only when tilt="ml". If TRUE then find tau and tau2 for exponential tilting (using initial values, if provided), and use those as initial values for solving the "ml" case. If FALSE, proceed directly to solving for the "ml" case, using initial and initial.tau2, if provided.
tol
tolerance for solving for tau on the scale of probs and Q. tau and tau2 are solved for iteratively. Values tau and tau2 uniquely determine (with L) a tilted mean q and probability P. Iterations will stop if the values of q and P for given iteration values of tau and tau2 are both within tol of Q and probs, respectively.

Iterations stop when either of the convergence criteria determined by tol or tol.tau are met. If you want just one of the criteria to apply, set the other tolerance to zero.

tol.tau
tolerance for solving for tau on the scale of tau. tau and tau2 are solved for iteratively. Let the differences between successive guesses at each step be dtau and dtau2. Then iterations stop if both dtau and dtau2 are smaller in absolute value than tol.tau.
maxiter
maximum number of iterations allowed for finding values of tau which bracket the solution for each p (after the root is bracketed additional iterations may be performed).

VALUE:

For revSaddlepointP, a matrix with length(tau) rows and three columns tau, tau2, and probs, the latter containing the calculated tail probabilities.

For revSaddlepointPSolve, a matrix with length(probs) rows and three columns probs, tau, and tau2.

DETAILS:

If tau or probs is a vector, results are equivalent to calling the function separately for each element of the vector (the explanation at the top, where we wrote exp(tau * L), assumes that tau is a scalar). Typically probs is a vector of desired probabilities for confidence intervals, e.g. c(0.025, 0.975).

These functions are useful as non-sampling approximations to bootstrap tilting inferences for a sample mean. To help understand the concept, consider exact confidence intervals for a binomial proportion; given an observed proportion phat, the one-sided 95% upper confidence interval by finding the value p such that pbinom(phat, n, p) = .95. Probability calculations are under a "tilted distribution" with parameter p (which corresponds probability calculations under the tilted distribution with parameter tau and weights w), rather than with parameter phat (which corresponds to the original data, before tilting). The corresponding bootstrap tilting (and reverse saddlepoint) intervals would use revSaddlepointPSolve -- see the example below.

In contrast, calculates saddlepoint estimates of P(Y < q) when Y is the sample mean of observations drawn from the untilted distribution.

In the group case, L is centered by subtracting the group mean from each group. Results are normalized to sum to 1 within each group.

REFERENCES:

Hesterberg, T.C. (1994), "Saddlepoint Quantiles and Distribution Curves, with Bootstrap Applications," Computational Statistics, 9(3), 207-212.

Kolassa, J.E. (1997). Series Approximation Methods in Statistics. Second edition; Springer-Verlag, Lecture Notes in Statistics, no. 88.

SEE ALSO:

, , , , , , , , .

EXAMPLES:

# Uses these input data: 
set.seed(1) 
x <- rexp(30) 
saddlepoint.test(x, mu=1) 
 
tau <- revSaddlepointPSolve(c(0.025, 0.975), x)[,2] 
tiltMean(tau, x)$q 
# match above t-test 95% bootstrap tilting confidence interval. 
 
saddlepoint.test(x, mu=1, alternative="greater") 
tau <- tiltMeanSolve(1, x)$tau.exp 
revSaddlepointP(tau, x)[,3]  # match above t-test tilting p-value. 
 
# input data for the following tests 
set.seed(1) 
xx <- rnorm(30) 
set.seed(1) 
ww <- rexp(30) 
tau.in <- seq(-.04, .04, .01) 
 
# Test exponential tilting: 
pp <- revSaddlepointP(tau.in, L=xx, weights= ww, Q= .8)[,3] 
tau.out <- revSaddlepointPSolve(pp, L=xx, weights=ww, Q=.8)[,2] 
all.equal(tau.in, tau.out, tol= 1e-4)   # T 
 
# Test maximum likelihood tilting: 
ppM <- revSaddlepointP(tau.in, L=xx, weights= ww, Q= .8, tilt= "ml")[,3] 
tauM.out <- revSaddlepointPSolve(ppM, L=xx, weights=ww, Q=.8, tilt= "ml")[,2] 
all.equal(tau.in, tauM.out, tol= 1e-4)  # T 
 
## Test when `useExpForInit = F' is necessary: 
#  revSaddlepointPSolve, exponential tilting 
revSaddlepointPSolve(.999, L=xx, weights=ww, Q=.8, tilt= "exp") 
#    probs      tau       tau2 
#    0.999  1.799083  -0.8119742 
# 
#  revSaddlepointPSolve, maximum likelihood tilting, `useExpForInit = T' 
revSaddlepointPSolve(.999, L=xx, weights=ww, Q=.8, tilt= "ml") 
#  probs tau tau2 
#  0.999  NA   NA 
# 
# This failed because the initial value of `tau' = 1.799083 resulted in 
# negative maximum likelihood weights. 
# 
# Use a different initial value. 
revSaddlepointPSolve(.999, L=xx, weights=ww, Q=.8, tilt= "ml", initial= 0.7, 
                     useExpForInit = F) 
#  probs        tau      tau2 
#  0.999  0.7120254  -0.6980718 
# 
# Check if the result is correct: 
revSaddlepointP(0.7120254, L=xx, weights=ww, Q=.8, tilt= "ml") 
#  tau        tau2       probs 
# 0.7120254  -0.6980718  0.999 
 
## Exact binomial confidence interval, and saddlepoint approximation 
L <- rep(0:1, c(13, 7))  # 7 successes in 20 tries 
uniroot(function(p) {pbinom(7, 20, p) - .05}, lower=.35, upper=.8)$root 
# 
# Exact one-sided interval is (-infinity, 0.558)  (or (0, 0.558)) 
tau <- revSaddlepointP(.95, L)[1] 
tiltMean(tau, L)$q 
# Saddlepoint approximation is .5820 -- differs because no continuity 
# correction and because saddlepoint estimates are not exact.