robustCor | R Documentation |
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").
robustCor(x, y)
x |
numeric vector |
y |
numeric vector |
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.