View source: R/naive.bayes.classifiers.R

Prediction with naive Bayes classifier for binary (Bernoulli) data | R Documentation |

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

```
bernoullinb.pred(xnew, pi, ni)
```

`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. |

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.

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

Michail Tsagris.

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

` bernoulli.nb, nb.cv `

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.