corrMatrix: Calculate a correlation matrix for a dataframe.

Description Usage Arguments Value Examples

View source: R/corrMatrix.r

Description

This function calculates a full correlation matrix for a given dataframe. Note that all numeric variables will be converted to ordered factors.

Usage

1
2
corrMatrix(dataframe, cop = "gauss", loss = "MH", domain = NULL, 
          subdomains = 1, method = "copula")

Arguments

dataframe

dataframe with variables.

cop

Only if method="copula": character string specifying which copula family to use.

loss

Only if method="copula": character string specifying which loss function to use.

domain

Only if method="copula": vector of length two specifying the allowed domain for theta. Defaults to the maximum domain.

subdomains

Only if method="copula": Integer specifying the number subdomains to perform numerical integration over. Used to avoid local optima.

method

Correlation method. Should be one of "copula", "empirical", or "spearman".

Value

k by k correlation matrix.

Examples

1
2
3
4
5
6
7
#Correlation matrix for multiple variables in a dataframe
mydf <- data.frame(W=rbinom(100,1,.5), X=rbinom(100,2,.5), Y=rbinom(100,3,.5), 
        Z=rbinom(100,4,.5));
corrMatrix(mydf,cop="gauss",loss="MH");
corrMatrix(mydf,method="spearman");
#should be equal to:
cor(mydf,method="spearman");

jeroenooms/JJcorr documentation built on May 19, 2019, 6:10 a.m.