plot_obs_VS_pred: plot_obs_VS_pred

View source: R/ranger_reg_plot.R

plot_obs_VS_predR Documentation

plot_obs_VS_pred

Description

Plot a scatterplot of observed and predicted values from a ranger model.

Usage

plot_obs_VS_pred(
  y,
  predicted_y,
  SampleIDs = NULL,
  prefix = "train",
  target_field = "value",
  metric = "MAE",
  span = 1,
  outdir = NULL
)

Arguments

y

The numeric values for labeling data.

predicted_y

The predicted values for y.

SampleIDs

The sample ids in the data table.

prefix

The prefix for the dataset in the training or testing.

target_field

A string indicating the target field of metadata for regression.

metric

A regression performance metric (i.e., MAE, RMSE, MSE, R_squared, Adj_R_squared, or Separman_rho) showed in the scatter plot.

span

Controls the amount of smoothing for the default loess smoother in the scatterplot. Smaller numbers produce wigglier lines, larger numbers produce smoother lines.

outdir

The output directory.

Author(s)

Shi Huang

Examples

set.seed(123)
x <- data.frame(rbind(t(rmultinom(7, 75, c(.201,.5,.02,.18,.099))),
            t(rmultinom(8, 75, c(.201,.4,.12,.18,.099))),
            t(rmultinom(15, 75, c(.011,.3,.22,.18,.289))),
            t(rmultinom(15, 75, c(.091,.2,.32,.18,.209))),
            t(rmultinom(15, 75, c(.001,.1,.42,.18,.299)))))
y<- 1:60
rf_model<-rf.out.of.bag(x, y)
plot_obs_VS_pred(y, predicted_y=rf_model$predicted, prefix="train", target_field="age", outdir=NULL)

shihuang047/crossRanger documentation built on Feb. 7, 2023, 10:03 p.m.