interval: Bootstrap confidence intervals

Description Usage Arguments Details Value Examples

View source: R/interval.R

Description

Some alternative confidence intervals are implemented

Usage

1
interval(x, method = "perc", conf.level = 0.95)

Arguments

x

Double vector. Bootstrap sample.

method

Character. See details.

conf.level

Double in(0,1). Confidence level

Details

The implemented methods are 'perc', the standard using the 'quantile' function R to find the percentile; ‘bca', see 'coxed::bca“ and ’student' based on the normal approximation.

Value

returns a vector of length 2 in which the first element is the lower bound and the second element is the upper bound

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(coxed)
x = rnorm(100000)
interval(x, method = "perc")
interval(x, method = "bca")
interval(x, method = "student")
interval(x, method = "Not implemented")

# Example Efron&Tibshirani p 154
x = c(52, 104, 146, 10, 51, 30, 40, 27, 46)
n = length(x)
m = mean (x)
s2 = sum((x-m)^2)/(n-1)
se = sqrt(s2)/sqrt(n)
c("mean" = m, "se" = se)
interval(x, method = "bca", conf.level = 0.9)

# The bootstrap t-interval, Sect 12.5
B = 2
xstar = sample(x, replace = T)
theta.hat = m
Zstarb =

thoree/inbred documentation built on March 28, 2021, 7:42 p.m.