File: abc.ci.Rd

package info (click to toggle)
boot 1.3-20-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,188 kB
  • sloc: makefile: 2
file content (99 lines) | stat: -rw-r--r-- 3,452 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
\name{abc.ci}
\alias{abc.ci}
\title{
Nonparametric ABC Confidence Intervals
}
\description{
Calculate equi-tailed two-sided nonparametric approximate bootstrap confidence 
intervals for a parameter, given a set of data and an estimator of the 
parameter, using numerical differentiation.  
}
\usage{
abc.ci(data, statistic, index=1, strata=rep(1, n), conf=0.95, 
       eps=0.001/n, \dots)
}
\arguments{
\item{data}{
A data set expressed as a vector, matrix or data frame.
}
\item{statistic}{
A function which returns the statistic of interest.  The function must
take at least 2 arguments; the first argument should be the data and the
second a vector of weights.  The weights passed to \code{statistic} will be 
normalized to sum to 1 within each stratum.  Any other arguments should be 
passed to \code{abc.ci} as part of the \code{\dots{}} argument.  
}
\item{index}{
If \code{statistic} returns a vector of length greater than 1, then this indicates
the position of the variable of interest within that vector.
}
\item{strata}{
A factor or numerical vector indicating to which sample each
observation belongs in multiple sample problems.  The default 
is the one-sample case.  
}
\item{conf}{
A scalar or vector containing the confidence level(s) of the required
interval(s).
}
\item{eps}{
The value of epsilon to be used for the numerical differentiation.
}
\item{...}{
Any other arguments for \code{statistic}.  These will be passed unchanged to
\code{statistic} each time it is called within \code{abc.ci}.
}}
\value{
A \code{length(conf)} by 3 matrix where each row contains the confidence level 
followed by the lower and upper end-points of the ABC interval at that
level.
}
\details{
This function is based on the function \code{abcnon} written by R. Tibshirani.
A listing of the original function is available in DiCiccio and Efron (1996).
The function uses numerical differentiation for the first and second
derivatives of the statistic and then uses these values to approximate
the bootstrap BCa intervals.  The total number of evaluations of the
statistic is \code{2*n+2+2*length(conf)} where \code{n} is the number of data points
(plus calculation of the original value of the statistic).  The function 
works for the multiple sample case
without the need to rewrite the statistic in an artificial form since
the stratified normalization is done internally by the function.
}
\references{
Davison, A.C. and Hinkley, D.V. (1997) 
\emph{Bootstrap Methods and Their Application}, Chapter 5. 
Cambridge University Press. 


DiCiccio, T. J. and Efron B. (1992) More accurate confidence intervals in 
exponential families. \emph{Biometrika}, \bold{79}, 231--245.


DiCiccio, T. J.  and Efron  B. (1996) Bootstrap confidence intervals (with
Discussion). 
\emph{Statistical Science}, \bold{11}, 189--228.
}
\seealso{
\code{\link{boot.ci}}
}
\examples{
\dontshow{op <- options(digits = 5)}
# 90\% and 95\% confidence intervals for the correlation 
# coefficient between the columns of the bigcity data

abc.ci(bigcity, corr, conf=c(0.90,0.95))

# A 95\% confidence interval for the difference between the means of
# the last two samples in gravity
mean.diff <- function(y, w)
{    gp1 <- 1:table(as.numeric(y$series))[1]
     sum(y[gp1, 1] * w[gp1]) - sum(y[-gp1, 1] * w[-gp1])
}
grav1 <- gravity[as.numeric(gravity[, 2]) >= 7, ]
abc.ci(grav1, mean.diff, strata = grav1$series)
\dontshow{options(op)}
}
\keyword{nonparametric}
\keyword{htest}