Learn R Programming

zebu (version 0.1.3.0)

local_association: Local Association Measures

Description

Subroutines called by lassie to compute local and global association measures from a list of probabilities.

Usage

local_association(x, measure, nr)

duchers_z(x)

pmi(x, normalize = FALSE)

npmi(x)

chisq(x, nr)

Arguments

x

list of probabilities as outputted by estimate_prob.

measure

name of measure to be used:

  • 'z': Ducher's 'z'.

  • 'pmi': Pointwise mutual information (in bits).

  • 'npmi': Normalized pointwise mutual information.

  • 'chisq': Chi-squared residuals.

nr

number of rows/samples. Only used to estimate chi-squared residuals.

normalize

Normalizes pointwise mutual information when calling pmi

Value

List containing the following values:

  • local: local association array (may contain NA, NaN and Inf values).

  • global: global association numeric value.

Details

  • local_association(x, measure = 'z') is equivalent to duchers_z(x).

  • local_association(x, measure = 'pmi') is equivalent to pmi(x).

  • local_association(x, measure = 'npmi') is equivalent to npmi(x) and pmi(x, normalize = TRUE).

See Also

lassie

Examples

Run this code
# NOT RUN {
# This is what happens behind the curtains in the 'lassie' function
# Here we compute the association between the 'Girth' and 'Height' variables
# of the 'trees' dataset

# 'select' and 'continuous' take column numbers or names
select <- c('Girth', 'Height') # select subset of trees
continuous <-c(1, 2) # both 'Girth' and 'Height' are continuous

# equal-width discretization with 3 bins
breaks <- 3

# Preprocess data: subset, discretize and remove missing data
pre <- preprocess(trees, select, continuous, breaks)

# Estimates marginal and multivariate probabilities from preprocessed data.frame
prob <- estimate_prob(pre$pp)

# Computes local and global association using Ducher's Z
lam <- local_association(prob, measure = 'z')
# }

Run the code above in your browser using DataLab