VVKL: Calculate Violating Variable-wise Kullback-Leibler divergence

Description Usage Arguments Value Author(s) Examples

View source: R/VVKL.R

Description

Calculates variable-wise Kullback-Leibler divergence between the two groups of samples which violate the linear relationship between two continuous variables.

Usage

1
2
VVKL(data, var1, var2, permute = 0, levels = NULL, plot = F,
  var1.name = "var1", var2.name = "var2")

Arguments

data

A numeric dataframe including no missing value

var1

A vector of continuous values indicating the first variable. (the order of values should be the same as the order of rows in data)

var2

A vector of continuous values indicating the second variable. (the order of values should be the same as the order of rows in data)

permute

An integer indicating the number of permutations for permutation test. If 0 (the default) no permutation test will be carried out.

levels

An integer value indicating the maximum number of levels of a categorical variable. To be used to distinguish the categorical variable. Defaults to NULL because it is supposed that data has been preprocessed using data_preproc and the categorical variables are specified.

plot

A logical indicating if the scatter plot of two variables is returned. It highlights the two outlier groups with different colors.

var1.name

The name of the first variable to be shown on the plot.

var2.name

The name of the second variable to be shown on the plot.

Value

If permute = 0 returns a dataframe including sorted Kullback-Liebler (KL) divergence. If permute > 0 returns a dataframe including p.values and sorted KL divergence.

Author(s)

Elyas Heidari

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data("NHANES")
## Using preprocessed data
data <- data_preproc(NHANES, levels = 15)
data$SEQN <- NULL
# Set permute to calculate p.values
kl <- VVKL(data, var1 = data$LBXTC, var2 = data$LBXVIE, permute = 100, levels = NULL)

## Using raw data and plot
kl <- VVKL(NHANES, var1 = data$LBXTC, var2 = data$LBXVIE, permute = 0, levels = 15,
plot = TRUE, var1.name = 'LBXTC', var2.name = 'LBXVIE')

bAIo-lab/Questools documentation built on Nov. 9, 2019, 3:59 a.m.