JSD: Jensen-Shannon Divergence

Description Usage Arguments Details Value Examples

Description

Jensen-Shannon Divergence

Usage

1

Arguments

formula

A formula of the form 'x1 ~ x2 + x3 + x4 + x5'. In this example, the JSD assumes x1 is the group variable and x2 through x5 are covariates. All variabels must be categorical (character or factor).

data

A data frame containing all variables mentioned in 'formula'.

Details

This function produces objects of class 'jsd_balance', each of which is a list containing the following elements:

1. freqs - the cell frequencies of the 2x2 table of the grouping variable against the covariate.

2. cell_contribs - individual cell contributions to the Jensen-Shannon divergence (JSD).

3. group_contribs - group-level contributions to the JSD. These are the column sums of 'cell_contribs'.

4. cov_contribs - covariate-level contributions to the JSD. These are the row sums of 'cell_contribs'.

5. jsd - overall JSD measure. This is the sum of all elements in 'cell_contribs'.

Value

A named list with entries for each variable on the righthand side of 'formula'. See details.

Examples

1
2
g_chop <- chop(glucose, glucose = list(cuts = c(0,109,125,300)))
jsd_balance(cohort ~ glucose, data = g_chop)

jarrod-dalton/jsd documentation built on Feb. 2, 2020, 12:23 p.m.