Naive Bayes classifiers for compositional data {Compositional}R Documentation

Naive Bayes classifiers for compositional data

Description

Naive Bayes classifiers for compositional data.

Usage

comp.nb(xnew = NULL, x, ina, type = "beta")

Arguments

xnew

A matrix with the new compositional predictor data whose class you want to predict. Zeros are not allowed

x

A matrix with the available compositional predictor data. Zeros are not allowed

ina

A vector of data. The response variable, which is categorical (factor is acceptable).

type

The type of naive Bayes, "beta", "logitnorm", "cauchy", "laplace", "gamma", "normlog" or "weibull". For the last 4 distributions, the negative of the logarithm of the compositional data is applied first.

Value

Depending on the classifier a list including (the ni and est are common for all classifiers):

shape

A matrix with the shape parameters.

scale

A matrix with the scale parameters.

expmu

A matrix with the mean parameters.

sigma

A matrix with the (MLE, hence biased) variance parameters.

location

A matrix with the location parameters (medians).

scale

A matrix with the scale parameters.

mean

A matrix with the scale parameters.

var

A matrix with the variance parameters.

a

A matrix with the "alpha" parameters.

b

A matrix with the "beta" parameters.

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.

References

Friedman J., Hastie T. and Tibshirani R. (2017). The elements of statistical learning. New York: Springer.

See Also

cv.compnb, alfa.rda, alfa.knn, comp.knn, mix.compnorm, dda

Examples

x <- Compositional::rdiri(100, runif(5) )
ina <- rbinom(100, 1, 0.5) + 1
a <- comp.nb(x, x, ina, type = "beta")

[Package Compositional version 6.9 Index]