SpNaBa-methods: Spatial Naive Bayes Model methods

Description Usage Arguments Value Author(s) References See Also Examples

Description

counts is a function to extract frequency information for the Spatial Naive Bayes Model.

laplace is a function to applied the Laplace smothing method to an object of class SpNaBaCounts.

Take a SpNaBaCounts object from counts and calculates the probability matrices for spatial data mining. The probability matrices are for joint and conditional probabilities.

Usage

1
2
3
4
5
6
7
8
## S4 method for signature 'SpNaBaMatrix'
counts(x.mat, target = NULL)

## S4 method for signature 'SpNaBaCounts'
laplace(x.counts, fac.lap = NULL)

## S4 method for signature 'SpNaBaCounts'
probs(x.counts, fac.lap = NULL)

Arguments

x.mat

A SpNaBaMatrix object.

target

character or numeric or logical or NULL. Indicates the columns of binmatrix slot to be consired as target factors.

x.counts

A SpNaBaCounts object.

fac.lap

numeric or NULL. it indicates the laplace factor to be applied. If NULL or missing the laplace factor applied is 0.01.

Value

counts: An object of class SpNaBaCounts.

laplace: An object of class SpNaBaCounts.

probs: An object of class SpNaBaProbs.

Author(s)

Enrique Del Callejo Canal (edelcallejoc@gmail.com), based on implemented algortihms in web platform SPECIES (see References).

References

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

See Also

SpNaBaCounts, SpNaBaMatrix, grd_build, id_pts

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Using the function id_pts() for spatial data --------

library(sp)
library(rgeos)
library(rgdal)
library(raster)

# Loading data
data(Mex0)
data(mammals)

# Generating de grid from Mex0 data
Mex0.grd<-grd_build(Mex0)

# Identification points of mammals
x.mat<-id_pts(grd = Mex0.grd, pts = mammals)

# Without target declaration --------------------------

system.time(x.counts <- counts(x.mat))

# With target declaration -----------------------------

x.counts <- counts(x.mat, target = 1:10)


# Appliying the Laplace smothing ----------------------

x.counts.ls <- laplace(x.counts, fac.lap = 0.1)


# Probability matrices -----------------------------------
x.probs <- probs(x.counts, fac.lap = 0.1)

edelcallejoc/rspecies documentation built on May 27, 2019, 7:25 a.m.