plot.nbc: Bar plot of top predicted causes from a NBC model

Description Usage Arguments Details See Also Examples

View source: R/nbc4va_main.R

Description

Plots the results from a nbc object as a barplot for a number of causes based on predicted Cause Specific Mortality Fraction (CSMF).

plotnbcex.png

Usage

1
2
3
4
5
6
## S3 method for class 'nbc'
plot(x, top.plot = length(x$causes.pred), min.csmf = 0,
  csmfa.obs = NULL, footnote = TRUE, footnote.color = "gray48",
  footnote.size = 0.7, main = paste("Naive Bayes Classifier: Top ",
  top.plot, " Causes by Predicted CSMF", sep = ""), xlab = "Predicted CSMF",
  col = "dimgray", horiz = TRUE, border = NA, las = 1, ...)

Arguments

x

A nbc object.

top.plot

A number that produces top k causes depending on a Cause Specific Mortality Fraction (CSMF) measure.

min.csmf

A number that represents the minimum CSMF measure for a cause to be included in the plot.

csmfa.obs

A character vector of the true causes for calculating the CSMF accuracy.

footnote

A boolean indicating whether to include a footnote containing details about the nbc or not.

footnote.color

A character specifying the color of the footnote text.

footnote.size

A numeric value specifying the size of the footnote text.

main

A character value of the title to display.

xlab

A character value of the x axis title.

col

A character value of the color to use for the plot.

horiz

Set to TRUE to draw bars horizontally and FALSE to draw bars vertically.

border

A character value of the colors to use for the bar borders. Set to NA to disable.

las

An integer value to determine if labels should be parallel or perpendicular to axis.

...

Additional arguments to be passed to barplot.

Details

See Methods documentation for details on CSMF and CSMF accuracy.

See Also

barplot

Other main functions: nbc, print.nbc_summary, summary.nbc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(nbc4va)
data(nbc4vaData)

# Run naive bayes classifier on random train and test data
train <- nbc4vaData[1:50, ]
test <- nbc4vaData[51:100, ]
results <- nbc(train, test)

# Plot the top 3 causes by CSMF
plot(results, top.plot=3)

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