Description Usage Arguments Value Examples
This is an implementation of an alternative to Person Correlation test as
implemented by cor.test
. It accepts the same arguments as
cor.test
. For more information regarding the model assumptions see:
http://sumsar.net/blog/2014/03/bayesianfirstaidpearsoncorrelationtest/
1 2 3 4 5 6 7 8 9 10  bayes.cor.test(x, ...)
## Default S3 method:
bayes.cor.test(x, y, alternative = c("two.sided", "less",
"greater"), method = c("pearson", "kendall", "spearman"), exact = NULL,
cred.mass = 0.95, continuity = FALSE, n.iter = 15000,
progress.bar = "text", conf.level, ...)
## S3 method for class 'formula'
bayes.cor.test(formula, data, subset, na.action, ...)

x, y 
numeric vectors of data values. 
... 
not used 
alternative 
ignored and is only retained in order to mantain
compatibility with 
method 
ignored 
exact 
ignored 
cred.mass 
the amount of probability mass that will be contained in
reported credible intervals. This argument fills a similar role as

continuity 
ignored 
n.iter 
The number of iterations to run the MCMC sampling. 
progress.bar 
The type of progress bar. Possible values are "text", "gui", and "none". 
conf.level 
same as 
formula 
a formula of the form 
data 
an optional matrix or data frame containing the variables in the
formula 
subset 
an optional vector specifying a subset of observations to be used. 
na.action 
a function which indicates what should happen when the data
contain NAs. Defaults to 
A list of class bayes_cor_test
that contains information about
the analysis. It can be further inspected using the functions
summary
, plot
, diagnostics
and
model.code
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  # Data from Hollander & Wolfe (1973), p. 187f.
# This example is borrowed from the documentation for cor.test().
# Assessment of tuna quality. We compare the Hunter L measure of
# lightness to the averages of consumer panel scores (recoded as
# integer values from 1 to 6 and averaged over 80 such values) in
# 9 lots of canned tuna.
x < c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1)
y < c( 2.6, 3.1, 2.5, 5.0, 3.6, 4.0, 5.2, 2.8, 3.8)
# First a classical correlation test:
cor.test(x, y)
# And here is the Bayesian first aid alternative:
bayes.cor.test(x, y)
# Save the output into a variable for easy plotting and further inspection:
fit < bayes.cor.test(x, y)
plot(fit)
summary(fit)
model.code(fit)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.