Learn R Programming

crimelinkage (version 0.0.3)

naiveBayes: Naive bayes classifier using histograms and shrinkage

Description

After binning, this adds pseudo counts to each bin count to give df approximate degrees of freedom. If partition=quantile, this does not assume a continuous uniform prior over support, but rather a discrete uniform over all (unlabeled) observations points.

Usage

naiveBayes(vars, X, df = 20, nbins = 30, partition = c("quantile",
  "width"))

Arguments

vars
the names or column numbers of specific predictors.
X
a data.frame of predictors, can include continuous and categorical/factors along with X$type (linked or unlinked) and X$weight
df
the degrees of freedom for each component density. if vector, each predictor can use a different df
nbins
the number of bins for continuous predictors
partition
for binning; indicates if breaks generated from quantiles or equal spacing

Value

  • BF a bayes factor object; list of component bayes factors

Details

Fits a naive bayes model to continous and categorical/factor predictors. Continous predictors are first binned, then estimates shrunk towards zero.

Examples

Run this code
# See vignette: "Statistical Methods for Crime Series Linkage" for usage.

Run the code above in your browser using DataLab