robustCor: Find a robust bootstrapped correlation

View source: R/robustCor.R

robustCorR Documentation

Find a robust bootstrapped correlation

Description

First optimally transforms x and y using YeoJohn (i.e., Yeo-Johnsons transformation with a lambda optimized to minimize skew). Then resamples the data 2000 times and, for each resample, calculates the Pearson correlation coefficient along with the corresponding T value and log-3 Bayes Factor (calculated with a default BayesFactor::correlationBF(x,y,'medium')). Returns a formatted string $results, the full resampled set of values in $resampled_tests, as well as individual values for the median $r and its corresponding $t and log-2 $bf. The $data is returned in a data frame with variables xt [transformed x] and yt [transformed y], each of which has a set of attributes (e.g., the "rawDat" and the Yeo-Johnson "lambda").

Usage

robustCor(x, y)

Arguments

x

numeric vector

y

numeric vector

Details

The 'medium' prior for BayesFactor::correlationBF is a transformed beta(3,3) ( see the BayesFactor documentation as well as Ly, Verhagen, and Wagenmakers (2015) )

Note that this function will not work with fewer than 9 cases. Because you probably shouldn't be calculating correlations with only 8 cases.


akcochrane/ACmisc documentation built on Nov. 24, 2024, 11:22 a.m.