SpNaBaProbs-class: Class SpNaBaProbs

Description Usage Arguments Value Slots Author(s) References Examples

Description

SpNaBaProbs is used to store probability information of the Naive Bayes model.

Usage

1
SpNaBaProbs(Pc, Px, Pc.x, Px.c, Px.nc, ...)

Arguments

Pc

numeric vector. See slot section for more details.

Px

numeric vector. See slot section for more details.

Pc.x

numeric matrix. See slot section for more details.

Px.c

numeric matrix. See slot section for more details.

Px.nc

numeric matrix. See slot section for more details.

...

argument pass to other methods.

Value

An object of class SpNaBaProbs. See slot section for more details.

Slots

Pc

numeric vector. It contains the marginal probabilities of the target variables declared in the NaBa model.

Px

numeric vector. It contains the marginal probabilities of the predictor variables declared in the NaBa model.

Pc.x

numeric matrix. Each element represents the condicional probability P(c|x). The sufix c.x implies that the rows of this matrix represents the target variables (c) and the columns represents the predictors variables (x) declared in the Naive Bayes model.

Px.c

numeric matrix. Each element represents the condicional probability P(x|c). The sufix x.c implies that the rows of this matrix represents the predictors variables (x) and the columns represents the target variables (c) declared in the Naive Bayes model.

Px.nc

numeric matrix. Each element represents the condicional probability P(x|c'). The sufix x.nc implies that the rows of this matrix represents the predictors variables (x) and the columns represents the complement of the target variables (c') declared in the Naive Bayes model.

Author(s)

Enrique Del Callejo Canal ([email protected]), based on implemented algortihms in web platform SPECIES (see References).

References

http://species.conabio.gob.mx/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Using SpNaBaMatrix constructor ----------------------

a <- matrix(rbinom(100, 100, runif(100, 0, 0.1)), nrow = 10, ncol = 10,
  dimnames = list(paste0("id:", 1:10), letters[1:10]))

x.mat <- SpNaBaMatrix(freqmatrix = a)

# Counts calculation ----------------------------------

x.counts <- counts(x.mat)

# Probability calculation -----------------------------

x.probs <- probs(x.counts)

edelcallejoc/rspecies documentation built on Dec. 17, 2018, 9:15 a.m.