bootstrap: Bootstrapping of correlation coefficients

Description Usage Arguments Value Examples

Description

Function of bootstrapping of correlation coefficients

Usage

1
bootstrap(x, y, n = 10000L, ...)

Arguments

x

double vector. The observations of the first variable.

y

double vector. The observations of the second variable.

n

integer. The number of replicates.

...

further arguments to the function cor

Value

A vector of n bootstrapping samples.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Sample some data
set.seed(123L)
x <- rnorm(50)
y <- x + rnorm(length(x))
cor(x, y)
## bootstrapping
bs <- bootstrap(x, y)
## bootstrap distribution
hist(bs)
## mean and standard-deviation of bootstrap distribution
c(mean(bs), sd(bs))
## two-sided 5% quantiles
quantile(x = bs, probs = c(0.025, 0.975))

DominikMueller64/dmisc documentation built on May 6, 2019, 2:52 p.m.