pcor: Partial correlations

View source: R/pcor.R

pcorR Documentation

Partial correlations

Description

Function calculates partial correlations between the provided variables

Usage

pcor(x, y = NULL, use = c("na.or.complete", "complete.obs", "everything",
  "all.obs"), method = c("pearson", "spearman", "kendall"))

Arguments

x

Either data.frame or a matrix with numeric values.

y

The numerical variable.

use

What observations to use. See cor function for details. The only option that is not available here is "pairwise.complete.obs".

method

Which method to use for the calculation of the partial correlations. This can be either Pearson's, Spearman's or Kendall's coefficient. See cor for details.

Details

The calculation is done based on multiple linear regressions. The function calculates them for each pair of variables based on the residuals of linear models of those variables from the other variables in the dataset.

Value

The following list of values is returned:

  • value - Matrix of the coefficients of partial correlations;

  • p.value - The p-values for the parameters;

  • method - The method used in the calculations.

Author(s)

Ivan Svetunkov, ivan@svetunkov.com

See Also

mcor, cramer, association

Examples


pcor(mtcars)


config-i1/greybox documentation built on Dec. 12, 2024, 1:42 p.m.