aboutsummaryrefslogtreecommitdiff
path: root/R/plot.mmkin.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-05-08 20:57:48 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-05-08 20:57:48 +0200
commitc6079a807e2b400fe0c772603392aeacd887da2f (patch)
tree5b590e06de87ce9cd5c776fccfabc8a629a10cad /R/plot.mmkin.R
parentc322a8102a399cbb1fe38c4c4ca4485cea8bc4e8 (diff)
Add functionality to plot the error model
by plotting squared residuals against predicted values, and showing the variance function used in the fitted error model. Rebuild docs
Diffstat (limited to 'R/plot.mmkin.R')
-rw-r--r--R/plot.mmkin.R14
1 files changed, 11 insertions, 3 deletions
diff --git a/R/plot.mmkin.R b/R/plot.mmkin.R
index ee7075d3..c9d98718 100644
--- a/R/plot.mmkin.R
+++ b/R/plot.mmkin.R
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 Johannes Ranke
+# Copyright (C) 2015-2016,2019 Johannes Ranke
# Contact: jranke@uni-bremen.de
# This file is part of the R package mkin
@@ -16,11 +16,15 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>
-plot.mmkin <- function(x, main = "auto", legends = 1, errmin_var = "All data", errmin_digits = 3,
+plot.mmkin <- function(x, main = "auto", legends = 1,
+ resplot = c("time", "errmod"),
+ errmin_var = "All data", errmin_digits = 3,
cex = 0.7, rel.height.middle = 0.9, ...) {
n.m <- nrow(x)
n.d <- ncol(x)
+ resplot <- match.arg(resplot)
+
# We can handle either a row (different models, same dataset)
# or a column (same model, different datasets)
if (n.m > 1 & n.d > 1) stop("Please select fits either for one model or for one dataset")
@@ -90,7 +94,11 @@ plot.mmkin <- function(x, main = "auto", legends = 1, errmin_var = "All data", e
}
mtext(chi2_text, cex = cex, line = 0.4)
- mkinresplot(fit, legend = FALSE, ...)
+ if (resplot == "time") {
+ mkinresplot(fit, legend = FALSE, ...)
+ } else {
+ mkinerrplot(fit, legend = FALSE, ...)
+ }
mtext(paste(fit_name, "residuals"), cex = cex, line = 0.4)
}

Contact - Imprint