plot_reg function

Plot Regression Curves

Plot Regression Curves

Plots regression curves for each set of records defined using by. A log-linear plot will be made for each curve.

plot_reg( x, by = character(0), th = NA, bloqvar = "bloq", timevar = "tad", depvar = "dv", timelab = "timevar", deplab = "depvar", exclvar = NA, plotdir = NA, ... )

Arguments

  • x: input dataset name
  • by: column names in x indicating grouping variables
  • th: file name of file with half-life estimation information for each curve
  • bloqvar: variable name containing the BLOQ flag (0: no, 1: yes)
  • timevar: variable name containing the actual sampling time after dose
  • depvar: variable name containing the dependent variable (e.g., concentration)
  • timelab: X-axis label (default: "timevar")
  • deplab: Y-axis label (default: "depvar")
  • exclvar: variable name containing information about points to be excluded (these should have exclvar = 1)
  • plotdir: directory where individual plot files will be saved
  • ...: ignored

Returns

(invisible) plotdir. If the attribute 'plotdir' is empty, plots will be generated in standard output, otherwise plots will be saved as PNG file in the designated directory.

Details

If elimination half-life was estimated for that curve, the following will be indicated in the plot:

  • Cmax (Yellow, even if no half-life was estimated)
  • points used in regression and resulting regression line (green)
  • points excluded from regression (red crossed)
  • estimate of elimination half-life and adjusted R-squared

Input dataset:

  • uncorrected dataset, used for half-life estimation
  • dataset containing results of the half-life estimation

Examples

example(est.thalf) x %>% filter(dv > 0) %>% plot_reg(by = 'subject', th = th)
  • Maintainer: Jan Huisman
  • License: GPL-3
  • Last published: 2021-08-16

Useful links