plot_binary_outcome: Plots binary outcome

Description Usage Arguments Value Examples

View source: R/plotting.R

Description

Plots binary outcome, use for binary models outcomes etc.

Usage

1
2
plot_binary_outcome(df, pred_name, actual_name, x_lab = NULL, y_lab = NULL,
  theme = NULL, type = "pipes", smooth = TRUE, smoothing_level = NA)

Arguments

df

Data

pred_name

Predictions' column name

actual_name

Actual values' column name

x_lab

X-axis label

y_lab

Y-axis label

theme

Theme function to use

type

Plot type, type = c('pipes', 'jitter')

smooth

Logical, whether plot smoothing line or not

smoothing_level

If smooth == TRUE the smoothing level, otherwise ignored

Value

Plot object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
df <- data.frame(
  actual = c(1,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0),
  predicted = seq(1, 0, length.out = 40)
)
plot_binary_outcome(df, 'predicted', 'actual')
plot_binary_outcome(df, 'predicted', 'actual', smoothing_level = 0.75)
plot_binary_outcome(df, 'predicted', 'actual', x_lab = 'Predicted', y_lab = 'Actual')
plot_binary_outcome(df, 'predicted', 'actual', theme = theme_bw())
plot_binary_outcome(df, 'predicted', 'actual', type = 'pipes', theme = theme_bw())
plot_binary_outcome(df, 'predicted', 'actual', type = 'jitter', theme = theme_bw())

m-dz/mdmisc documentation built on May 22, 2019, 12:23 p.m.