Description Usage Arguments Value Examples
Written in C++, this function should always run faster than
cov
for numeric vectors. For integer vectors,
cov_i
should run even faster.
1 | cov_n(x, y)
|
x, y |
Numeric vector. |
Numeric value.
1 2 3 4 5 6 7 8 9 10 11 | # In general, cov_n is much faster than cov
x <- rnorm(1000)
y <- rnorm(1000)
all.equal(cov(x, y), cov_n(x, y))
benchmark(cov(x, y), cov_n(x, y), replications = 5000)
# For integer vectors, cov_i should be even faster.
x <- rpois(1000, lambda = 5)
y <- rpois(1000, lambda = 5)
all.equal(cov(x, y), cov_i(x, y))
benchmark(cov(x, y), cov_n(x, y), cov_i(x, y), replications = 5000)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.