## calc median and bootstrap confidence intervals
boot.median <- function(x, Rep = 10000, ...){
require(boot)
b <- boot(x, function(x, i){ median(x[i]) }, R = Rep, ...)
bci <- boot.ci(b, type = 'perc')
res <- c(Median = bci$t0, Lower = bci$percent[4], Upper = bci$percent[5])
return(res)
}
## coefficient of variation (CV)
CV <- function(x) sd(x) / mean(x)
## bootstrap confidence interval of CI
bootCV <- function(x, Rep = 1000, ...){
require(boot)
b <- boot(x, function(x, i){ CV(x[i]) }, R = Rep, ...)
bci <- boot.ci(b, type = 'perc')
res <- c(CV = bci$t0, Lower = bci$percent[4], Upper = bci$percent[5])
return(res)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.