ova2nbc: Translate open verbal autopsy arguments to train a NBC model

Description Usage Arguments Value References Examples

View source: R/nbc4va_extra.R

Description

A wrapper function for creating an nbc object with the parameters specified by the openVA package.

Usage

1
ova2nbc(symps.train, symps.test, causes.train, causes.table = NULL, ...)

Arguments

symps.train

Dataframe of verbal autopsy train data.

  • Columns (in order): ID, Cause, Symptom-1 to Symptom-n..

  • ID (vectorof char): case identifiers

  • Cause (vectorof char): observed causes for each case

  • Symptom-n.. (vectorsof char): "Y" for presence, "" for absence, "." for missing

Example:

ID Cause S1 S2 S3
"a1" "HIV" "Y" "" "."
"b2" "Stroke" "." "" "Y"
"c3" "HIV" "Y" "Y" "."
symps.test

Dataframe of verbal autopsy test data in the same format as symps.train.

  • If (causes.train is (vectorof char)): symps.test is assumed to not have a cause column

causes.train

The train vector or column for the causes of death to use.

  • If (vectorof char): cause of death values with number of values equal to nrow(symps.train); it is assumed that symps.test has no causes of death column

  • If (char): name of cause of death column from symps.train

causes.table

Character list of unique causes to learn.

  • If (NULL): set to unique causes of death in symps.train

...

Additional arguments to be passed to avoid errors if necessary.

Value

nbc An nbc object with the following modifications:

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
library(openVA)  # install.packages("openVA")
library(nbc4va)

# Obtain some openVA formatted data
data(RandomVA3) # cols: deathId, cause, symptoms..
train <- RandomVA3[1:100, ]
test <- RandomVA3[101:200, ]

# Run naive bayes classifier on openVA data
results <- ova2nbc(train, test, "cause")

# Obtain the probabilities and predictions
prob <- results$prob.causes
pred <- results$pred.causes

## End(Not run)

nbc4va documentation built on May 2, 2019, 1:42 p.m.