SpNaBaCounts-class: Class SpNaBaCounts

Description Usage Arguments Value Slots Author(s) References Examples

Description

SpNaBaCounts is used to store frequency information of the Naive Bayes model.

Usage

1
SpNaBaCounts(N, Nc, Nx, Ncx, ...)

Arguments

N

vector of length 1. See slot section for more details.

Nc

vector. See slot section for more details.

Nx

vector. See slot section for more details.

Ncx

matrix. See slot section for more details.

...

argument pass to other methods.

Value

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

Slots

N

numeric of length 1. It contains the number of blocks of the partition of the sample space. If the model is not for spatial data, N is the number of cases in the sample. If the model is for spatial data, N is the number of cells in the grid (see gr_build).

Nc

numeric. Each element represents the number of blocks with at least one observation of target factor $c$. If the model is not for spatial data Nc represents the number of cases with presences of target factor $c$. If the model is for spatial data Nc represents the number of cell in the GRID with at least one obervations of the target factor $c$.

Nx

numeric. Each element represents the number of blocks with at least one observation of predictor factor $x$. If the model is not for spatial data Nx represents the number of cases with presences of predictor factor $x$. If the model is for spatial data Nx represents the number of cell in the GRID with at least one obervations of the predictor factor $x$.

Ncx

matrix. Each element represents the number of blocks with at least one observation of target factor $c$ and predictor factor $x$. If the model is not for spatial data Ncx represents the joint frequency of target factor $c$ and the predictor factor $x$. If the model is for spatial data Ncx represents the number of cell in the GRID with at least one obervations of the target factor $c$ and the predictor factor $x$.

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
# Using SpNaBaMatrix constructor ----------------------

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

x.mat <- SpNaBaMatrix(freqmatrix = a)

SpNaBaCounts(N = nrow(x.mat@binmatrix),
             Nc = colSums(x.mat@binmatrix),
             Nx = colSums(x.mat@binmatrix),
             Ncx = t(x.mat@binmatrix) %*% x.mat@binmatrix)

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