binChi {AssocBin} | R Documentation |
Statistics for bins
Description
These functions compute statistics based on observed and expected counts for a list of bins.
Usage
binChi(bins, agg = sum)
binMI(bins, agg = sum)
binAbsDif(bins, agg = sum)
Arguments
bins |
a list of bins, each a list with elements 'x', 'y', 'depth', 'bnds' (list with elements 'x' and 'y'), 'expn', 'n' |
agg |
function which is aggregates the individual statistics computed over each bin |
Details
Binstatistics
Three functions are provided by default, 'binChi' computes the chi-squared statistic by taking the squared difference between observed and expected counts and dividing this by the expected counts. 'binMi' computes the mutual information for each bin using the observed and expected counts. Finally, 'binAbsDif' computes the absolute difference between observed and expected counts. Each function first computes a value on every bin independently and stores all these values in memory before using the function provided in the optional argument 'agg' to aggregate these values.
Value
A list with elements 'residuals' and 'stat' reporting the individual statistic values (possibly transformed) and the aggegrated statistic value.
Functions
-
binChi()
: Chi-squared statistic -
binMI()
: Mutual information -
binAbsDif()
: Absolute difference between observed and expected
Author(s)
Chris Salahub
Examples
binList1 <- list(list(x = c(1,2), y = c(3,1), depth = 1, n = 2,
expn = 2),
list(x = c(3,4), y = c(2,4), depth = 1, n = 2,
expn = 2))
binList2 <- list(list(x = c(1,2), y = c(3,1), depth = 6, n = 2,
expn = 4),
list(x = c(), y = c(), depth = 1, n = 0, expn = 1))
binChi(binList1)
binChi(binList2)
binMI(binList1)
binMI(binList2)
binAbsDif(binList2)