cor_boot: Bootstrapped Confidence Intervals for Correlations

Description Usage Arguments Value See Also Examples

View source: R/cor_boot.R

Description

Calculates the bias-corrected and accelerated (BCa) bootstrap confidence interval for correlation coefficients.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cor_boot(
  x,
  y = NULL,
  use = "pairwise",
  method = "pearson",
  n_rep = 10000,
  conf = 0.95,
  seed = 42,
  n_cores = NULL,
  ...
)

Arguments

x

a numeric matrix or data frame.

y

NULL (default) or a matrix or data frame with compatible dimensions to x. The default is equivalent to y = x (but more efficient).

use

an optional character string giving a method for handling missing values. This must be (an abbreviation of) one of the strings "everything", "all.obs", "complete.obs", or "pairwise.complete.obs" (default). See cor for explanation of these options.

method

a character string indicating which correlation coefficient is to be computed. One of "pearson" (default), "kendall", or "spearman": can be abbreviated.

n_rep

The number of bootstrap replicates.

conf

A scalar or vector containing the confidence level(s) of the required interval(s). 95% intervals used by default.

seed

Integer used to seed the random number generator.

n_cores

Integer indicating number of processes to use in parallel processing. Set to 1 fewer than the number of available CPUs by default.

Value

Object of class "cor_boot", a cor_list object with the following additional vectors:

lower

lower endpoint of the confidence interval

upper

upper endpoint of the confidence interval

and the attribute "CI" indicating the size of the confidence interval being returned.

See Also

boot.ci, cor, cor_list,

Examples

1
2
3
4
5
# Correlations with 95% CI for the numeric variables from the iris data set
cor_boot(iris[,-5], n_rep = 1000)

# with 99% CI
cor_boot(iris[,-5], n_rep = 1000, conf = 0.99)

jashu/corxplor documentation built on Dec. 10, 2019, 7:09 p.m.