chances: Estimate Bernoulli Parameters from Binary Matrix with Class...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/chances.R

Description

chances estimates Bernoulli parameters (=chances) from a binary matrix and associated class labels.

Usage

1
chances(X, L, lambda.freqs, verbose=TRUE)

Arguments

X

data matrix (columns correspond to variables, rows to samples).

L

factor containing the class labels, one for each sample (row).

lambda.freqs

shrinkage parameter for class frequencies (if not specified it is estimated).

verbose

report shrinkage intensity and other information.

Details

The class-specific chances are estimated using the empirical means over the 0s and 1s in each class. For estimating the pooled mean the class-specific means are weighted using the estimated class frequencies. Class frequencies are estimated using freqs.shrink.

Value

chances returns a list with the following components:

samples: the samples in each class,

regularization: the shrinkage intensity used to estimate the class frequencies,

freqs: the estimated class frequencies,

means: the estimated chances (parameters of Bernoulli distribution, expectations of 1s) for each variable conditional on class, as well as the marginal changes (pooled means).

Author(s)

Sebastian Gibb and Korbinian Strimmer (http://strimmerlab.org).

See Also

is.binaryMatrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# load binda library
library("binda")

# example binary matrix with 6 variables (in columns) and 4 samples (in rows)
Xb = matrix(c(1, 1, 0, 1, 0, 0,
             1, 1, 1, 1, 0, 0,
             1, 0, 0, 0, 1, 1,
             1, 0, 0, 0, 1, 1), nrow=4, byrow=TRUE)
colnames(Xb) = paste0("V", 1:ncol(Xb))

# Test for binary matrix
is.binaryMatrix(Xb) # TRUE

L = factor(c("Treatment", "Treatment", "Control", "Control") )

chances(Xb, L)

binda documentation built on May 1, 2019, 7:30 p.m.

Related to chances in binda...