exp.tilt                package:boot                R Documentation

Exponential Tilting

Description:

     This function calculates exponentially tilted multinomial
     distributions  such that the resampling distributions of the
     linear approximation to a statistic have the required means.

Usage:

     exp.tilt(L, theta=NULL, t0=0, lambda=NULL,
              strata=rep(1, length(L)))

Arguments:

       L: The empirical influence values for the statistic of interest
          based on the  observed data.  The length of 'L' should be the
          same as the size of the  original data set.  Typically 'L'
          will be calculated by a call to 'empinf'. 

   theta: The value at which the tilted distribution is to be centred. 
          This is not required if 'lambda' is supplied but is needed
          otherwise. 

      t0: The current value of the statistic.  The default is that the
          statistic equals 0. 

  lambda: The Lagrange multiplier(s).  For each value of 'lambda' a
          multinomial  distribution is found with probabilities
          proportional to 'exp(lambda * L)'.  In general 'lambda' is
          not known and so 'theta' would be supplied, and the
          corresponding value of 'lambda' found.  If both 'lambda' and
          'theta' are supplied then 'lambda' is ignored and the
          multipliers for tilting to 'theta' are found. 

  strata: A vector or factor of the same length as 'L' giving the
          strata for the observed data and the empirical influence
          values 'L'. 

Details:

     Exponential tilting involves finding a set of weights for a data
     set to ensure that the bootstrap distribution of the linear
     approximation to a  statistic of interest has mean 'theta'.  The
     weights chosen to achieve this are given by 'p[j]' proportional to
      'exp(lambda*L[j]/n)', where 'n' is the number of data points.  
     'lambda' is then  chosen to make the mean of the bootstrap
     distribution, of the linear approximation to the statistic of
     interest, equal to the the required value 'theta'.  Thus 'lambda'
     is defined as the  solution of a nonlinear equation.    The
     equation is solved by minimizing the Euclidean distance between 
     the left and right hand sides of the equation using the function
     'nlmin'. If this minimum is not equal to zero then the method
     fails.

     Typically exponential tilting is used to find suitable weights for
     importance resampling.  If a small tail probability or quantile of
     the distribution of the statistic of interest is required then a
     more efficient simulation is to centre the resampling distribution
     close to the point of interest and then use the functions
     'imp.prob' or 'imp.quantile' to estimate the required quantity.

     Another method of achieving a similar shifting of the distribution
     is through the use of 'smooth.f'.  The function 'tilt.boot' uses
     'exp.tilt' or 'smooth.f' to find the weights for a tilted
     bootstrap.

Value:

     A list with the following components :

       p: The tilted probabilities.  There will be 'm' distributions
          where 'm' is the length of 'theta' (or 'lambda' if supplied).
           If 'm' is 1 then 'p' is a vector of 'length(L)'
          probabilities.  If 'm' is greater than 1 then 'p' is a matrix
          with 'm' rows, each of which contain 'length(L)'
          probabilities.  In this case the vector 'p[i,]' is the
          distribution tilted to 'theta[i]'.  'p' is in the form
          required by the argument 'weights' of the function 'boot' for
          importance resampling. 

  lambda: The Lagrange multiplier used in the equation to determine the
          tilted probabilities.  'lambda' is a vector of the same
          length as 'theta'. 

   theta: The values of 'theta' to which the distributions have been
          tilted.  In general this will be the input value of 'theta'
          but if 'lambda' was supplied then  this is the vector of the
          corresponding 'theta' values. 

References:

     Davison, A. C. and Hinkley, D. V. (1997)  _Bootstrap Methods and
     Their Application_. Cambridge University Press.

     Efron, B. (1981) Nonparametric standard errors and confidence
     intervals  (with Discussion). _Canadian Journal of Statistics_,
     *9*, 139-172.

See Also:

     'empinf', 'imp.prob', 'imp.quantile', 'optim', 'smooth.f',
     'tilt.boot'

Examples:

     # Example 9.8 of Davison and Hinkley (1997) requires tilting the resampling
     # distribution of the studentized statistic to be centred at the observed
     # value of the test statistic 1.84.  This can be achieved as follows.
     grav1 <- gravity[as.numeric(gravity[,2])>=7,]
     grav.fun <- function(dat, w, orig)
     {    strata <- tapply(dat[, 2], as.numeric(dat[, 2]))
          d <- dat[, 1]
          ns <- tabulate(strata)
          w <- w/tapply(w, strata, sum)[strata]
          mns <- tapply(d * w, strata, sum)
          mn2 <- tapply(d * d * w, strata, sum)
          s2hat <- sum((mn2 - mns^2)/ns)
          as.vector(c(mns[2]-mns[1],s2hat,(mns[2]-mns[1]-orig)/sqrt(s2hat)))
     }
     grav.z0 <- grav.fun(grav1,rep(1,26),0)
     grav.L <- empinf(data=grav1, statistic=grav.fun, stype="w", 
                      strata=grav1[,2], index=3, orig=grav.z0[1])
     grav.tilt <- exp.tilt(grav.L, grav.z0[3], strata=grav1[,2])
     boot(grav1, grav.fun, R=499, stype="w", weights=grav.tilt$p,
          strata=grav1[,2], orig=grav.z0[1])

