Prediction with naive Bayes classifier for binary (Bernoulli) data {Rfast2}R Documentation

Prediction with naive Bayes classifier for binary (Bernoulli) data

Description

Prediction with naive Bayes classifier for binary (Bernoulli) data.

Usage

bernoullinb.pred(xnew, pi, ni)

Arguments

xnew

A numerical matrix with new predictor variables whose group is to be predicted. Each column refers to an angular variable.

pi

A matrix with the estimated probabilities of each group.

ni

The sample size of each group in the dataset.

Details

Each column is supposed to contain binary data. Thus, for each column a Berboulli distributions is fitted. The product of the densities is the joint multivariate distribution.

Value

A numerical vector with 1, 2, ... denoting the predicted group.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

See Also

bernoulli.nb, nb.cv

Examples

x <- matrix( rbinom(50 * 4, 1, 0.5), ncol = 4 )
ina <- rbinom(50, 1, 0.5) + 1
a <- bernoulli.nb(x, x, ina)

[Package Rfast2 version 0.1.5.2 Index]