Learn R Programming

mkin (version 0.9-31)

plot.mkinfit: Plot the observed data and the fitted model of an mkinfit object.

Description

Solves the differential equations with the optimised and fixed parameters from a previous successful call to mkinfit and plots the observed data together with the solution of the fitted model.

Usage

## S3 method for class 'mkinfit':
plot(x, fit = x,
  obs_vars = names(fit$mkinmod$map),
  xlab = "Time", ylab = "Observed", 
  xlim = range(fit$data$time),
  ylim = "default",
  col_obs = 1:length(fit$mkinmod$map), pch_obs = col_obs, 
  lty_obs = rep(1, length(fit$mkinmod$map)),
  add = FALSE, legend = !add,
  show_residuals = FALSE, maxabs = "auto",
  lpos = "topright", inset = c(0.05, 0.05), ...)

Arguments

x
Alias for fit introduced for compatibility with the generic S3 method.
fit
an object of class mkinfit.
obs_vars
A character vector of names of the observed variables for which the data and the model should be plotted. Defauls to all observed variables in the model.
xlab
label for the x axis.
ylab
label for the y axis.
xlim
plot range in x direction.
ylim
plot range in y direction.
col_obs
colors used for plotting the observed data and the corresponding model prediction lines.
pch_obs
symbols to be used for plotting the data.
lty_obs
line types to be used for the model predictions.
add
should the plot be added to an existing plot?
legend
should a legend be added to the plot?
show_residuals
should residuals be shown in the lower third of the plot?
maxabs
Maximum absolute value of the residuals. This is used for the scaling of the y axis and defaults to "auto".
lpos
position of the legend. Passed to legend as the first argument.
inset
Passed to legend if applicable.
...
further arguments passed to plot.

Value

  • The function is called for its side effect.

Examples

Run this code
# One parent compound, one metabolite, both single first order.
SFO_SFO <- mkinmod(
  parent = list(type = "SFO", to = "m1", sink = TRUE),
  m1 = list(type = "SFO"))
# Fit the model to the FOCUS example dataset D using defaults
fit <- mkinfit(SFO_SFO, FOCUS_2006_D)
plot(fit)

Run the code above in your browser using DataLab