# vm.nb: Naive Bayes classifiers for directional data In Rfast2: A Collection of Efficient and Extremely Fast R Functions II

 Naive Bayes classifiers for circular data R Documentation

## Naive Bayes classifiers for directional data

### Description

Naive Bayes classifiers for directional data.

### Usage

``````vm.nb(xnew = NULL, x, ina, tol = 1e-07)
spml.nb(xnew = NULL, x, ina, tol = 1e-07)
``````

### Arguments

 `xnew` A numerical matrix with new predictor variables whose group is to be predicted. Each column refers to an angular variable. `x` A numerical matrix with observed predictor variables. Each column refers to an angular variable. `ina` A numerical vector with strictly positive numbers, i.e. 1,2,3 indicating the groups of the dataset. Alternatively this can be a factor variable. `tol` The tolerance value to terminate the Newton-Raphson algorithm.

### Details

Each column is supposed to contain angular measurements. Thus, for each column a von Mises distribution or an circular angular Gaussian distribution is fitted. The product of the densities is the joint multivariate distribution.

### Value

A list including:

 `mu` A matrix with the mean vectors expressed in radians. `mu1` A matrix with the first set of mean vectors. `mu2` A matrix with the second set of mean vectors. `kappa` A matrix with the kappa parameters for the vonMises distribution or with the norm of the mean vectors for the circular angular Gaussian distribution. `ni` The sample size of each group in the dataset. `est` The estimated group of the xnew observations. It returns a numerical value back regardless of the target variable being numerical as well or factor. Hence, it is suggested that you do \"as.numeric(ina)\" in order to see what is the predicted class of the new data.

### Author(s)

Michail Tsagris.

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

### See Also

` vmnb.pred, weibull.nb, nb.cv `

### Examples

``````x <- matrix( runif( 100, 0, 1 ), ncol = 2 )
ina <- rbinom(50, 1, 0.5) + 1
a <- vm.nb(x, x, ina)
``````

Rfast2 documentation built on May 29, 2024, 8:45 a.m.