Model residuals plotted against the independent variable (IDV).

The residuals can be one of:

  • RES: model residuals

  • WRES: weighted model residuals

  • CWRES: conditional weighted model residuals

  • EWRES/ECWRES: Monte Carlo based model residuals

  • NPDE: Normalized prediction distribution error

res_vs_idv(xpdb, mapping = NULL, res = "CWRES", group = "ID",
  type = "pls", title = "@y vs. @x | @run", subtitle = "Ofv: @ofv",
  caption = "@dir", tag = NULL, log = NULL, guide = TRUE, facets,
  .problem, quiet, ...)

absval_res_vs_idv(xpdb, mapping = NULL, res = "CWRES", group = "ID",
  type = "pls", title = "@y vs. @x  | @run", subtitle = "Ofv: @ofv",
  caption = "@dir", tag = NULL, log = NULL, guide = FALSE, facets,
  .problem, quiet, ...)



An xpose database object.


List of aesthetics mappings to be used for the xpose plot (e.g. point_color).


Type of residual to be used. Default is "CWRES".


Grouping variable to be used for lines.


String setting the type of plot to be used. Can be points 'p', line 'l', smooth 's' and text 't' or any combination of the four.


Plot title. Use NULL to remove.


Plot subtitle. Use NULL to remove.


Page caption. Use NULL to remove.


Plot identification tag. Use NULL to remove.


String assigning logarithmic scale to axes, can be either '', 'x', y' or 'xy'.


Enable guide display (e.g. unity line).


Either a character string to use facet_wrap_paginate or a formula to use facet_grid_paginate.


The $problem number to be used. By default returns the last estimation problem.


Logical, if FALSE messages are printed to the console.


Any additional aesthetics to be passed on xplot_scatter.

Layers mapping

Plots can be customized by mapping arguments to specific layers. The naming convention is layer_option where layer is one of the names defined in the list below and option is any option supported by this layer e.g. point_color = 'blue', smooth_method = 'lm', etc.

  • point: options to geom_point

  • line: options to geom_line

  • guide: options to geom_abline

  • smooth: options to geom_smooth

  • text: options to geom_text

  • xscale: options to scale_x_continuous or scale_x_log10

  • yscale: options to scale_y_continuous or scale_y_log10

Template titles

Template titles can be used to create highly informative diagnostics plots. They can be applied to any plot title, subtitle, caption and tag. Template titles are defined via a single string containing key variables staring with a `@` (e.g. `@ofv`) which will be replaced by their actual value when rendering the plot. For example `'@run, @nobs observations in @nind subjects'` would become `'run001, 1022 observations in 74 subjects'`. The available key variables are listed under template_titles.

See also


# Standard residual res_vs_idv(xpdb_ex_pk, res = c('IWRES', 'CWRES'))
#> Using data from $prob no.1
#> Filtering data by EVID == 0
#> Tidying data by ID, SEX, MED1, MED2, DOSE ... and 24 more variables
# Absolute value of the residuals absval_res_vs_idv(xpdb_ex_pk, res = 'CWRES')
#> Using data from $prob no.1
#> Filtering data by EVID == 0