boot_cor_test: Bootstrapped correlation coefficients

View source: R/boot_cor_test.R

boot_cor_testR Documentation

Bootstrapped correlation coefficients

Description

[Stable]

A function for a bootstrap, percentile, method for correlation coefficients.

Usage

boot_cor_test(
  x,
  y,
  alternative = c("two.sided", "less", "greater", "equivalence", "minimal.effect"),
  method = c("pearson", "kendall", "spearman", "winsorized", "bendpercent"),
  alpha = 0.05,
  null = 0,
  boot_ci = c("basic", "perc"),
  R = 1999,
  ...
)

Arguments

x

a (non-empty) numeric vector of data values.

y

an optional (non-empty) numeric vector of data values.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater", "less", "equivalence" (TOST), or "minimal.effect" (TOST). You can specify just the initial letter.

method

a character string indicating which correlation coefficient is to be used for the test. One of "winsorized", "bendpercent","pearson", "kendall", or "spearman", can be abbreviated.

alpha

alpha level (default = 0.05)

null

a number indicating the null hypothesis. Default is a correlation of zero.

boot_ci

type of bootstrap confidence interval. Options include studentized (stud), empirical/basic (basic) and percentile (perc) confidence intervals.

R

number of bootstrap replicates

...

further arguments to be passed to or from methods.

Details

This function uses a percentile bootstrap methods for the confidence intervals. The returned p-values are calculated from a re-sampled null distribution (similar to boot_t_TOST). See vignette("correlations") for more details.

The bootstrap correlation methods in this package offer two other correlations: a Winsorized correlation and a percentage bend correlation (see Wilcox 2017). These two can modified by adding the trim (Winsorized) or beta (percentage bend) arguments. The default for both arguments is 0.2 but can be modified at the user's discretion. These calculations are based on Rand Wilcox's R functions for his book (Wilcox, 2017), and adapted from their implementation in Guillaume Rousselet's R package "bootcorci".

Value

A list with class "htest" containing the following components:

  • "p.value": the p-value of the test.

  • "estimate": the estimated measure of association, with name "pb", "wincor", "cor", "tau", or "rho" corresponding to the method employed.

  • "null.value": the value of the association measure under the null hypothesis.

  • "alternative": character string indicating the alternative hypothesis (the value of the input argument alternative).

  • "method": a character string indicating how the association was measured.

  • "data.name": a character string giving the names of the data.

  • "call": the matched call.

References

Wilcox, R.R. (2009) Comparing Pearson Correlations: Dealing with Heteroscedasticity and Nonnormality. Communications in Statistics - Simulation and Computation, 38, 2220–2234.

Wilcox, R.R. (2017) Introduction to Robust Estimation and Hypothesis Testing, 4th edition. Academic Press.

See Also

Other Correlations: corsum_test(), plot_cor(), power_z_cor(), z_cor_test()


TOSTER documentation built on May 29, 2024, 9:57 a.m.