Rev 5789 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{norm.ci}\alias{norm.ci}\title{Normal Approximation Confidence Intervals}\description{Using the normal approximation to a statistic, calculate equi-tailed two-sidedconfidence intervals.}\usage{norm.ci(boot.out = NULL, conf = 0.95, index = 1, var.t0 = NULL,t0 = NULL, t = NULL, L = NULL, h = function(t) t,hdot = function(t) 1, hinv = function(t) t)}\arguments{\item{boot.out}{A bootstrap output object returned from a call to \code{boot}. If\code{t0} is missing then \code{boot.out} is a required argument. It isalso required if both \code{var.t0} and \code{t} are missing.}\item{conf}{A scalar or vector containing the confidence level(s) of the requiredinterval(s).}\item{index}{The index of the statistic of interest within the output of a call to\code{boot.out$statistic}. It is not used if \code{boot.out} ismissing, in which case \code{t0} must be supplied.}\item{var.t0}{The variance of the statistic of interest. If it is not supplied then\code{var(t)} is used.}\item{t0}{The observed value of the statistic of interest. If it is missing then it istaken from \code{boot.out} which is required in that case.}\item{t}{Bootstrap replicates of the variable of interest. These are used to estimatethe variance of the statistic of interest if \code{var.t0} is notsupplied. The default value is \code{boot.out$t[,index]}.}\item{L}{The empirical influence values for the statistic of interest. These areused to calculate \code{var.t0} if neither \code{var.t0} nor\code{boot.out} are supplied. If a transformation is supplied through\code{h} then the influence values must be for the untransformedstatistic \code{t0}.}\item{h}{A function defining a monotonic transformation, the intervals arecalculated on the scale of \code{h(t)} and the inverse function\code{hinv} is applied to the resulting intervals. \code{h} must be afunction of one variable only and must be vectorized. The default isthe identity function.}\item{hdot}{A function of one argument returning the derivative of \code{h}. Itis a required argument if \code{h} is supplied and is used forapproximating the variance of \code{h(t0)}. The default is theconstant function 1.}\item{hinv}{A function, like \code{h}, which returns the inverse of \code{h}. It isused to transform the intervals calculated on the scale of \code{h(t)}back to the original scale. The default is the identity function. If\code{h} is supplied but \code{hinv} is not, then the intervals returnedwill be on the transformed scale.}}\value{If \code{length(conf)} is 1 then a vector containing the confidencelevel and the endpoints of the interval is returned. Otherwise, thereturned value is a matrix where each row corresponds to a differentconfidence level.}\details{It is assumed that the statistic of interest has an approximatelynormal distribution with variance \code{var.t0} and so a confidenceinterval of length \code{2*qnorm((1+conf)/2)*sqrt(var.t0)} is found.If \code{boot.out} or \code{t} are supplied then the interval isbias-corrected using the bootstrap bias estimate, and so the intervalwould be centred at \code{2*t0-mean(t)}. Otherwise the interval iscentred at \code{t0}.}\note{This function is primarily designed to be called by \code{boot.ci} tocalculate the normal approximation after a bootstrap but it can also beused without doing any bootstrap calculations as long as \code{t0} and\code{var.t0} can be supplied. See the examples below.}\references{Davison, A.C. and Hinkley, D.V. (1997)\emph{Bootstrap Methods and Their Application}. Cambridge University Press.}\seealso{\code{\link{boot.ci}}}\examples{# In Example 5.1 of Davison and Hinkley (1997), normal approximation# confidence intervals are found for the air-conditioning data.air.mean <- mean(aircondit$hours)air.n <- nrow(aircondit)air.v <- air.mean^2/air.nnorm.ci(t0 = air.mean, var.t0 = air.v)exp(norm.ci(t0 = log(air.mean), var.t0 = 1/air.n)[2:3])# Now a more complicated example - the ratio estimate for the city data.ratio <- function(d, w)sum(d$x * w)/sum(d$u *w)city.v <- var.linear(empinf(data = city, statistic = ratio))norm.ci(t0 = ratio(city,rep(0.1,10)), var.t0 = city.v)}\keyword{htest}% Converted by Sd2Rd version 1.15.