Description Usage Arguments Examples
The default correlation is the percentage bend.
The function corfun is any function that returns a correlation coefficient in corfun$cor. The functions pbcor and wincor follow this convention.
When using Pearson's correlation, and when n<250, use lsfitci instead.
The default number of bootstrap samples is nboot=599
1 |
x |
|
y |
|
corfun |
|
nboot |
|
SEED |
|
... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, y, corfun = pbcor, nboot = 599, SEED = T, ...)
{
est <- corfun(x, y, ...)$cor
if (SEED)
set.seed(2)
data <- matrix(sample(length(y), size = length(y) * nboot,
replace = T), nrow = nboot)
bvec <- apply(data, 1, corbsub, x, y, corfun, ...)
ihi <- floor(0.975 * nboot + 0.5)
ilow <- floor(0.025 * nboot + 0.5)
bsort <- sort(bvec)
corci <- 1
corci[1] <- bsort[ilow]
corci[2] <- bsort[ihi]
phat <- sum(bvec < 0)/nboot
sig <- 2 * min(phat, 1 - phat)
list(cor.ci = corci, p.value = sig, cor.est = est)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.