AlterCorr: Alternatives to the Pearson correlation with p-values

Description Usage Arguments Examples

View source: R/AlterCorr.R

Description

This function returns the value of the correlation between two variables and its corresponding p-value for four types of coefficients; Pearson correlation (r), Maximum information coefficient (MIC); Random dependency coefficient (RDC) and Correlation of distances (dCor).

Usage

1
AlterCorr(x, y, type = c("pearson", "MIC", "RDC", "dCor"), R = 100)

Arguments

x

A numeric vector

y

A numeric vector of the same dimension as x

type

Specifies the type of correlations to compute. "Pearson" for the Pearson Correlation, "MIC" for the Maximum Information Coefficient, "RDC" for the Random Dependency Coefficient and finally "dCor" for the Correlation of Distances.

R

Number of permutations to be made for MIC and dCor to calculate the p-values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#Lineal dependence
x<-rnorm(200, sd=2.5)
y<-2*x+rnorm(200, sd=2.5)
AlterCorr(x, y, type="pearson")
AlterCorr(x, y, type="MIC",R=10)
AlterCorr(x, y, type="RDC")
AlterCorr(x, y, type="dCor",R=100)

#No dependency
x<-rnorm(200, mean=2, sd =1.8)
y<-rnorm(200, mean=0, sd =2.5)
AlterCorr(x, y, type="pearson")
AlterCorr(x, y, type="MIC",R=10)
AlterCorr(x, y, type="RDC")
AlterCorr(x, y, type="dCor",R=100)

AnaBPazos/AlterCorr documentation built on May 20, 2019, 4:24 p.m.