From 3410513f55b3f8b5c4331f4fb4487613d3a28208 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 4 Nov 2019 23:48:20 +0100 Subject: Scaled residual plots --- man/mkinresplot.Rd | 16 ++++++++++------ man/plot.mkinfit.Rd | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'man') diff --git a/man/mkinresplot.Rd b/man/mkinresplot.Rd index 27e1322f..465b3038 100644 --- a/man/mkinresplot.Rd +++ b/man/mkinresplot.Rd @@ -5,7 +5,8 @@ \title{Function to plot residuals stored in an mkin object} \usage{ mkinresplot(object, obs_vars = names(object$mkinmod$map), xlim = c(0, - 1.1 * max(object$data$time)), xlab = "Time", ylab = "Residual", + 1.1 * max(object$data$time)), standardized = FALSE, xlab = "Time", + ylab = ifelse(standardized, "Standardized residual", "Residual"), maxabs = "auto", legend = TRUE, lpos = "topright", col_obs = "auto", pch_obs = "auto", frame = TRUE, ...) } @@ -18,15 +19,17 @@ the model} \item{xlim}{plot range in x direction.} -\item{xlab}{Label for the x axis. Defaults to "Time [days]".} +\item{standardized}{Should the residuals be standardized by dividing by the +standard deviation given by the error model of the fit?} -\item{ylab}{Label for the y axis. Defaults to "Residual [\% of applied -radioactivity]".} +\item{xlab}{Label for the x axis.} + +\item{ylab}{Label for the y axis.} \item{maxabs}{Maximum absolute value of the residuals. This is used for the scaling of the y axis and defaults to "auto".} -\item{legend}{Should a legend be plotted? Defaults to "TRUE".} +\item{legend}{Should a legend be plotted?} \item{lpos}{Where should the legend be placed? Default is "topright". Will be passed on to \code{\link{legend}}.} @@ -58,7 +61,8 @@ mkinresplot(fit, "m1") } \seealso{ \code{\link{mkinplot}}, for a way to plot the data and the fitted - lines of the mkinfit object. + lines of the mkinfit object, and \code{\link{plot_res}} for a function + combining the plot of the fit and the residual plot. } \author{ Johannes Ranke diff --git a/man/plot.mkinfit.Rd b/man/plot.mkinfit.Rd index 3834eaf5..6824f8a5 100644 --- a/man/plot.mkinfit.Rd +++ b/man/plot.mkinfit.Rd @@ -16,9 +16,13 @@ lpos = "topright", inset = c(0.05, 0.05), show_errmin = FALSE, errmin_digits = 3, frame = TRUE, ...) -plot_sep(fit, show_errmin = TRUE, ...) +plot_sep(fit, show_errmin = TRUE, + show_residuals = ifelse(identical(fit$err_mod, "const"), TRUE, + "standardized"), ...) -plot_res(fit, sep_obs = FALSE, show_errmin = sep_obs, ...) +plot_res(fit, sep_obs = FALSE, show_errmin = sep_obs, + show_residuals = ifelse(identical(fit$err_mod, "const"), TRUE, + "standardized"), ...) plot_err(fit, sep_obs = FALSE, show_errmin = sep_obs, ...) } @@ -54,7 +58,9 @@ corresponding model prediction lines.} \item{show_residuals}{Should residuals be shown? If only one plot of the fits is shown, the residual plot is in the lower third of the plot. Otherwise, i.e. if "sep_obs" is given, the residual plots will be located -to the right of the plots of the fitted curves.} +to the right of the plots of the fitted curves. If this is set to +'standardized', a plot of the residuals divided by the standard deviation + given by the fitted error model will be shown.} \item{show_errplot}{Should squared residuals and the error model be shown? If only one plot of the fits is shown, this plot is in the lower third of @@ -89,6 +95,8 @@ chi2 error percentage.} \item{frame}{Should a frame be drawn around the plots?} \item{\dots}{Further arguments passed to \code{\link{plot}}.} + +\item{standardized}{For} } \value{ The function is called for its side effect. @@ -113,6 +121,7 @@ SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1", full = "Parent"), fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE, error_model = "tc") plot(fit) plot_res(fit) +plot_res(fit, standardized = FALSE) plot_err(fit) # Show the observed variables separately, with residuals -- cgit v1.2.1