Description Usage Arguments Examples
This function returns the bootstrapped mean and median, and the respective confidence intervals, of the supplied numeric vector.
1 2 |
x |
A vector of numerical values. |
p.level |
A number giving the level of confidence for the intervals |
nrep |
The number of repetitions, or resamples, to perform. Defaults to
|
exact.thrs |
Upper level of |
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 | bootstats(rnorm(1000), p.level=0.9, smooth=FALSE)
bootstats(c(1, 3, 4, 4, 6, 7, 9), exact.thrs=7, smooth=FALSE)
bootstats(c(1, 3, 4, 4, 6, 7, 8), exact.thrs=1, smooth=FALSE)
## Simple smooth function based on jitter()
bootstats(1:5, smooth=function(b=b) jitter(b))
## Alternative entropy based smooth function
x <- round(rnorm(15, 10, 2))
entropy <- function(x, base=2) {
freqs <- table(x) / length(x)
-sum(freqs * log(freqs, base=base))
}
H5 <- entropy(x, base=5)
bootstats(x,
smooth=function(b=b, x=x, H5=H5) {
b + rnorm(length(b), 0, H5/sqrt(length(x)))
})
bootstats(x)
## Return resamples and plot distribution of means
bst <- bootstats(c(1, 2, 2, 4), return_resamples=TRUE)
t(bst[[2]])
plot(density(colMeans(bst[[2]])))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.