Skip to contents

Creates a plot of error versus iteration, to assess the trajectory of the objective function value of a `discourse.object`.

Usage

plot_error(discourse_obj, run = 1, show_best = TRUE, first_iter = 1)

Arguments

discourse_obj

A `discourse.object` S3 object produced by `optim_*` functions, containing a `track_error` element (numeric vector or list of vectors).

run

Integer. Index of the run to plot when `track_error` is a list; default `1`.

show_best

Logical. If `TRUE`, adds a point marking the minimum error; default `TRUE`.

first_iter

Integer. Number of initial iterations to skip before plotting (zero-based); default `1` (plots from iteration 2 onward).

Value

A `ggplot2` object.

Examples

 if (FALSE) { # \dontrun{
result <- optim_lme(args = ..., ...)
plot_error(result, first_iter = 500)
} # }