Learn R Programming

psycho (version 0.4.91)

correlation: Multiple Correlations.

Description

Compute different kinds of correlation matrices.

Usage

correlation(df, df2 = NULL, type = "full", method = "pearson",
  adjust = "holm", i_am_cheating = FALSE)

Arguments

df

The dataframe.

df2

Optional dataframe to correlate with the first one.

type

A character string indicating which correlation type is to be computed. One of "full" (default), "partial" (partial correlations), "semi" (semi-partial correlations), "glasso" (Graphical lasso- estimation of Gaussian graphical models) or "cor_auto" (will use the qgraph::cor_auto function to return pychoric or polyserial correlations if needed).

method

A character string indicating which correlation coefficient is to be computed. One of "pearson" (default), "kendall", or "spearman" can be abbreviated.

adjust

What adjustment for multiple tests should be used? ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none"). See p.adjust for details about why to use "holm" rather than "bonferroni").

i_am_cheating

Set to TRUE to run many uncorrected correlations.

Value

output

Examples

Run this code
# NOT RUN {
df <- attitude

# Normal correlations
results <- psycho::correlation(df)
print(results)
plot(results)

# Partial correlations with correction
results <- psycho::correlation(df,
  type = "partial",
  method = "spearman",
  adjust = "holm"
)
print(results)
plot(results)
# }

Run the code above in your browser using DataLab