bfcor | R Documentation |
Calculates sequential Bayes Factors for correlation between two continuous variables, showing how evidence evolves as data accumulates. Uses 'correlationBF' from the BayesFactor package.
bfcor(
x,
y,
alternative = c("two.sided", "greater", "less"),
prior.r = 0.1,
nstart = 5,
exact = TRUE
)
x |
A vector containing continuous data |
y |
A vector containing continuous data |
alternative |
Direction of alternative hypothesis: "two.sided", "greater", or "less" |
prior.r |
Scale parameter for the prior distribution (default: 0.1) |
nstart |
Minimum number of data points before first BF calculation (>= 2) |
exact |
Logical. If TRUE, calculates BF for all points; if FALSE, uses steps for efficiency |
A list of class "seqbf" containing:
r: Pearson correlation coefficient
p-value: from classical correlation test
BF: vector of sequential Bayes Factors
test type: "correlation"
prior: list with prior distribution details
sample size: total number of observations
alternative: chosen alternative hypothesis
x <- rnorm(100)
y <- x + rnorm(100, 0, 0.5) # Correlated data
result <- bfcor(x, y, alternative = "greater")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.