aboutsummaryrefslogtreecommitdiff
path: root/R/mkinerrplot.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-10-25 00:37:42 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-10-25 02:03:54 +0200
commit0a3eb0893cb4bd1b12f07a79069d1c7f5e991495 (patch)
tree1bf0ffeb710b3438fee224d0a657606b4c36b495 /R/mkinerrplot.R
parent053bf27d3f265c7a7378e2df3e00cf891e0d1bb2 (diff)
Use roxygen for functions and methods
Diffstat (limited to 'R/mkinerrplot.R')
-rw-r--r--R/mkinerrplot.R56
1 files changed, 39 insertions, 17 deletions
diff --git a/R/mkinerrplot.R b/R/mkinerrplot.R
index 6153a3c0..36e22a43 100644
--- a/R/mkinerrplot.R
+++ b/R/mkinerrplot.R
@@ -1,22 +1,44 @@
-# Copyright (C) 2008-2014,2019 Johannes Ranke
-# Contact: jranke@uni-bremen.de
-
-# This file is part of the R package mkin
-
-# mkin is free software: you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation, either version 3 of the License, or (at your option) any later
-# version.
-
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-
-# You should have received a copy of the GNU General Public License along with
-# this program. If not, see <http://www.gnu.org/licenses/>
if(getRversion() >= '2.15.1') utils::globalVariables(c("variable", "residual"))
+#' Function to plot squared residuals and the error model for an mkin object
+#'
+#' This function plots the squared residuals for the specified subset of the
+#' observed variables from an mkinfit object. In addition, one or more dashed
+#' line(s) show the fitted error model. A combined plot of the fitted model
+#' and this error model plot can be obtained with \code{\link{plot.mkinfit}}
+#' using the argument \code{show_errplot = TRUE}.
+#'
+#' @param object A fit represented in an \code{\link{mkinfit}} object.
+#' @param obs_vars A character vector of names of the observed variables for
+#' which residuals should be plotted. Defaults to all observed variables in
+#' the model
+#' @param xlim plot range in x direction.
+#' @param xlab Label for the x axis.
+#' @param ylab Label for the y axis.
+#' @param maxy Maximum value of the residuals. This is used for the scaling of
+#' the y axis and defaults to "auto".
+#' @param legend Should a legend be plotted?
+#' @param lpos Where should the legend be placed? Default is "topright". Will
+#' be passed on to \code{\link{legend}}.
+#' @param col_obs Colors for the observed variables.
+#' @param pch_obs Symbols to be used for the observed variables.
+#' @param frame Should a frame be drawn around the plots?
+#' @param \dots further arguments passed to \code{\link{plot}}.
+#' @return Nothing is returned by this function, as it is called for its side
+#' effect, namely to produce a plot.
+#' @author Johannes Ranke
+#' @seealso \code{\link{mkinplot}}, for a way to plot the data and the fitted
+#' lines of the mkinfit object.
+#' @keywords hplot
+#' @examples
+#'
+#' \dontrun{
+#' model <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
+#' fit <- mkinfit(model, FOCUS_2006_D, error_model = "tc", quiet = TRUE)
+#' mkinerrplot(fit)
+#' }
+#'
+#' @export
mkinerrplot <- function (object,
obs_vars = names(object$mkinmod$map),
xlim = c(0, 1.1 * max(object$data$predicted)),

Contact - Imprint