predict_naBa: Predict outcome of new data

Description Usage Arguments Value Examples

View source: R/Predict_naBa.R

Description

You can use 'Predict_naBa' with any data frame.

Usage

1
2
predict_naBa(prior, newdata, type = c("class", "raw"), eps = 0,
  threshold = 0.001)

Arguments

prior

Prior information. (output of Info_prior())

newdata

with the same format as prior dataset. (Output of prep())

type

Type of outcome you want: "Class" prediction or "Raw" probabilities.

eps

A small number to specify an epsilon-range for Laplace smoothing; default=0.

threshold

Replace cells value under epsilon range; default=0.001.

Value

'output': If type="class", returns a vector of predicted classes ; If type="raw", returns a matrix of conditional probabilities.

Examples

1
2
3
4
5
6
data(mood)
x=mood[,1:5]
y=mood[,6]
prior=Info_prior(x,y)  #Laplace=0 as default
newdata=mood[1:200,1:5]
myresult=predict_naBa(prior,newdata,"raw")

LiArAu/NaBa documentation built on Nov. 27, 2019, 9:28 p.m.