Description Usage Arguments Details Value Author(s) See Also Examples
chances
estimates Bernoulli parameters (=chances) from a binary matrix and associated class labels.
1 |
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. |
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
.
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).
Sebastian Gibb and Korbinian Strimmer (https://strimmerlab.github.io).
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.