estimate_prob: Estimate marginal and multivariate probabilities

View source: R/RcppExports.R

estimate_probR Documentation

Estimate marginal and multivariate probabilities

Description

Maximum-likelihood estimation of marginal and multivariate observed and expected independence probabilities. Marginal probability refers to probability of each factor per individual column. Multivariate probability refer to cross-classifying factors for all columns.

Usage

estimate_prob(x)

Arguments

x

data.frame or matrix.

Value

List containing the following values:

  • margins: a list of marginal probabilities. Names correspond to colnames(x).

  • observed: observed multivariate probability array.

  • expected: expected multivariate probability array

Examples

# 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')

zebu documentation built on Aug. 25, 2023, 5:17 p.m.