binda {binda} | R Documentation |
Binary Discriminant Analysis: Model Fit and Class Prediction
Description
binda
trains a diagonal multivariate Bernoulli model.
predict.binda
performs corresponding class prediction.
Usage
binda(Xtrain, L, lambda.freqs, verbose=TRUE)
## S3 method for class 'binda'
predict(object, Xtest, verbose=TRUE, ...)
Arguments
Xtrain |
A matrix containing the training data set. Note that the rows correspond to observations and the columns to variables. |
L |
A factor with the class labels of the training samples. |
lambda.freqs |
Shrinkage intensity for the frequencies. If not specified it is
estimated from the data. |
verbose |
Report shrinkage intensities (binda) and number of used features (predict.binda). |
object |
An |
Xtest |
A matrix containing the test data set. Note that the rows correspond to observations and the columns to variables. |
... |
Additional arguments for generic predict. |
Details
For detailed description of binary discriminant analysis as implented in binda
see Gibb and Strimmer (2015).
Value
predict.binda
predicts class probabilities for each test sample and returns
a list with two components:
class |
a factor with the most probable class assignment for each test sample, and |
posterior |
a matrix containing the respective class posterior probabilities. |
Author(s)
Sebastian Gibb and Korbinian Strimmer (https://strimmerlab.github.io).
References
Gibb, S., and K. Strimmer. 2015. Differential protein expression and peak selection in mass spectrometry data by binary discriminant analysis. Bioinformatics 31:3156-3162. <DOI:10.1093/bioinformatics/btv334>
See Also
Examples
# load "binda" library
library("binda")
# training data set with labels
Xtrain = 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(Xtrain) = paste0("V", 1:ncol(Xtrain))
is.binaryMatrix(Xtrain) # TRUE
L = factor(c("Treatment", "Treatment", "Control", "Control") )
# learn predictor
binda.fit = binda(Xtrain, L)
# predict classes using new test data
Xtest = matrix(c(1, 1, 0, 1, 1, 1,
1, 0, 0, 0, 1, 1), nrow=2, byrow=TRUE)
colnames(Xtest) = paste0("V", 1:ncol(Xtest))
predict(binda.fit, Xtest)