cor_test {BFpack} | R Documentation |
Bayesian correlation analysis
Description
Estimate the unconstrained posterior for the correlations using a joint uniform prior.
Usage
cor_test(..., formula = NULL, iter = 5000, burnin = 3000, nugget.scale = 0.995)
Arguments
... |
matrices (or data frames) of dimensions n (observations) by p (variables) for different groups (in case of multiple matrices or data frames). |
formula |
an object of class |
iter |
number of iterations from posterior (default is 5000). |
burnin |
number of iterations for burnin (default is 3000). |
nugget.scale |
a scalar which serves to avoid violations of positive definite correlation matrices. It should be very close to 1 (the default is .995). |
Value
list of class cor_test
:
-
meanF
posterior means of Fisher transform correlations -
covmF
posterior covariance matrix of Fisher transformed correlations -
correstimates
posterior estimates of correlation coefficients -
corrdraws
list of posterior draws of correlation matrices per group -
corrnames
names of all correlations
Examples
# Bayesian correlation analysis of the 6 variables in 'memory' object
# we consider a correlation analysis of the first three variable of the memory data.
#fit <- cor_test(BFpack::memory[,1:3])
# Bayesian correlation of variables in memory object in BFpack while controlling
# for the Cat variable
#fit <- cor_test(BFpack::memory[,c(1:4)],formula = ~ Cat)
# Example of Bayesian estimation of polyserial correlations
#memory_example <- memory[,c("Im","Rat")]
#memory_example$Rat <- as.ordered(memory_example$Rat)
#fit <- cor_test(memory_example)
# Bayesian correlation analysis of first three variables in memory data
# for two different groups
#HC <- subset(BFpack::memory[,c(1:3,7)], Group == "HC")[,-4]
#SZ <- subset(BFpack::memory[,c(1:3,7)], Group == "SZ")[,-4]
#fit <- cor_test(HC,SZ)