correlate: Function to compute various correlation measures between two...

correlateR Documentation

Function to compute various correlation measures between two variables

Description

Correlate is a function that cestimates correlation between two variables, which can be either continuous, categorical (ordered factor) or censored (survival data).

Usage

correlate(X, Y, method = c("pearson", "spearman", "kendall", "frequency", "cramersv",
		"cindex"),strata, weights, outX = TRUE, bootstrap_count = 0, alpha = 0.05,
 		alternative = c("two.sided", "less", "greater"))

Arguments

X

Vector of type numeric, ordered factor, or Surv.

Y

Vector of type numeric, ordered factor, or Surv of same length as X.

method

One of the following values: pearson, spearman, kendall, frequency, cramersv, or cindex.

strata

Vector of type factor corresponding to the sample strata.

weights

Vector of type numeric corresponding to the sample weights.

outX

For cindex, if set to TRUE, ignore ties; otherwise, take them into account when computing the concordance index.

bootstrap_count

If set to 0, analytical standard error for the correlation estimate in each strata is used to compute the meta-estimate (inverse-variance weighting avarega); otherwise a number of bootstraps are used to computes standard errors.

alpha

The probability of Type I error that is, rejecting a null hypothesis when it is in fact true

alternative

a character string specifying the alternative hypothesis,must be one of two.sided (default), greater or less. You can specify just the initial letter.

Details

The correlate function could be used to measure correlation between any types of variables:

numeric vs. numeric

Pearson, Spearman, Kendall or concordance index

numeric vs. ordered factor

concordance index (Somers' Dxy)

numeric vs. survival data

concordance index (Somers' Dxy)

ordered factor vs. ordered factor

Carmer's V

ordered factor vs. survival data

concordance index (Somers' Dxy)

survival data vs. survival data

concordance index (Somers' Dxy)

Part of the code underlying correlate is also used in mim method of the mRMRe.Data object because correlations are used to build the mutual information matrix in order for feature selection to take place. This is why these two functions have many argiuments in common.

Value

estimate

point estimate

se

standard error

lower

lower confidence bound

upper

upper confidence bound

p

p-value

n

sample size

Author(s)

Nicolas De Jay, Simon Papillon-Cavanagh, Benjamin Haibe-Kains

See Also

mRMRe.Data-class

Examples

set.thread.count(2)

## load data
data(cgps)
   
## spearman correlation coefficent between the first gene and Camptothecin IC50
correlate(X=cgps.ge[ ,1], Y=cgps.ic50, method="spearman")
   
## concordance index between the first gene and Camptothecin IC50
correlate(X=cgps.ge[ ,1], Y=cgps.ic50, method="cindex")

mRMRe documentation built on April 25, 2023, 9:13 a.m.