plot_pred: Plot predicted versus observed values

Description Usage Arguments Value Examples

Description

Plot predicted versus observed values

Usage

1
2
plot_pred(predicted, observed, perfect_line = TRUE, outlier_idx = NULL,
  labs = NULL, xlab = "Observed", ylab = "Predicted", title = "")

Arguments

predicted

numeric vector of predictions

observed

numeric vector of observations

perfect_line

logical whether to plot a blue 45 degree line on which perfect predictions would fall

outlier_idx

integer indices of outliers to be labelled between the predicted and observed value pairs are labeled an outlier

labs

character labels for points, applied to a subset determined by the 'outlier_criterion'

xlab

character label for the x-axis, defaults to "Observed"

ylab

character label for the y-axis, defaults to "Predicted"

title

character title defaults to ""

Value

a ggplot object

Examples

1
2
3
4
5
6
7
library(randomForest)
library(edarf)
fit = randomForest(hp ~ ., mtcars)
pred = predict(fit, newdata = mtcars)
plot_pred(pred, mtcars$hp,
  outlier_idx = which(abs(pred - mtcars$hp) > .5 * sd(mtcars$hp)),
  labs = row.names(mtcars))

edarf documentation built on May 2, 2019, 2:39 a.m.