Skip to contents

Comprehensive correlation analysis including Pearson, Spearman, and Kendall correlations with significance tests, confidence intervals, and natural language reporting. Suitable for exploring relationships between continuous variables.

Usage

jcorrelation(
  data,
  vars,
  group = NULL,
  method = "pearson",
  alternative = "two.sided",
  ci = TRUE,
  ciWidth = 95,
  flag = TRUE,
  flagAlpha = 0.05,
  plots = TRUE,
  plotType = "matrix",
  report = TRUE
)

Arguments

data

The data as a data frame.

vars

A vector of strings naming the variables to correlate.

group

Variable to split the analysis by.

method

The correlation method to use: 'pearson' (default), 'spearman', or 'kendall'.

alternative

The alternative hypothesis: 'two.sided' (default), 'greater', or 'less'.

ci

TRUE (default) or FALSE, provide confidence intervals.

ciWidth

Confidence interval level (default: 95 percent).

flag

TRUE (default) or FALSE, flag significant correlations.

flagAlpha

Alpha level for flagging significant correlations (default: 0.05).

plots

TRUE (default) or FALSE, provide correlation plots.

plotType

Type of correlation plot: 'matrix' (default), 'pairs', or 'network'.

report

TRUE (default) or FALSE, provide natural language interpretation.

Value

A results object containing:

results$matrixcorrelation matrix with significance tests
results$testsdetailed correlation tests for each pair of variables
results$summarysummary of correlation analysis
results$reporta html
results$plotan image
results$plotMatrixan image
results$plotPairsan image
results$plotNetworkan image

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$matrix$asDF

as.data.frame(results$matrix)