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

Prediction with some naive Bayes classifiers | R Documentation |

Prediction with some naive Bayes classifiers.

```
weibullnb.pred(xnew, shape, scale, ni)
normlognb.pred(xnew, expmu, sigma, ni)
laplacenb.pred(xnew, location, scale, ni)
logitnormnb.pred(xnew, m, s, ni)
betanb.pred(xnew, a, b, ni)
cauchynb.pred(xnew, location, scale, ni)
```

`xnew` |
A numerical matrix with new predictor variables whose group is to be predicted. For the Gaussian naive Bayes, this is set to NUUL, as you might want just the model and not to predict the membership of new observations. For the Gaussian case this contains positive numbers (greater than or equal to zero), but for the multinomial and Poisson cases, the matrix must contain integer valued numbers only. For the logistic normal (logitnormnb.pred) the data must be percentages strictly between 0 and 1. |

`shape` |
A matrix with the group shape parameters. Each row corresponds to a group. |

`scale` |
A matrix with the group scale parameters of the Laplace or the Cauchy distribution. Each row corresponds to a group. |

`expmu` |
A matrix with the group mean parameters. Each row corresponds to a group. |

`m` |
A matrix with the group mean parameters. Each row corresponds to a group. |

`sigma` |
A matrix with the group (MLE, hence biased) variance parameters. Each row corresponds to a group. |

`s` |
A matrix with the group MLE variance parameters. Each row corresponds to a group. |

`location` |
A matrix with the group location parameters of the Laplace or of the Cauchy distribution. Each row corresponds to a group. |

`a` |
A matrix with the group "alpha" parameters of the beta distribution. Each row corresponds to a group. |

`b` |
A matrix with the group "beta" parameters of the beta distribution. Each row corresponds to a group. |

`ni` |
A vector with the frequencies of each group. |

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

Michail Tsagris.

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

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

```
x <- matrix( rweibull( 100, 3, 4 ), ncol = 2 )
ina <- rbinom(50, 1, 0.5) + 1
a <- weibull.nb(x, x, ina)
est <- weibullnb.pred(x, a$shape, a$scale, a$ni)
table(ina, est)
```

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.