aboutsummaryrefslogtreecommitdiff
path: root/R/mkinresplot.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/mkinresplot.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/mkinresplot.R')
-rw-r--r--R/mkinresplot.R14
1 files changed, 7 insertions, 7 deletions
diff --git a/R/mkinresplot.R b/R/mkinresplot.R
index 3650ef4b..739a80e9 100644
--- a/R/mkinresplot.R
+++ b/R/mkinresplot.R
@@ -23,7 +23,7 @@ mkinresplot <- function (object,
xlab = "Time", ylab = "Residual",
maxabs = "auto", legend= TRUE, lpos = "topright", ...)
{
- obs_vars_all <- as.character(unique(object$data$variable))
+ obs_vars_all <- as.character(unique(object$data$variable))
if (length(obs_vars) > 0){
obs_vars <- intersect(obs_vars_all, obs_vars)
@@ -33,18 +33,18 @@ mkinresplot <- function (object,
if (maxabs == "auto") maxabs = max(abs(residuals), na.rm = TRUE)
- col_obs <- pch_obs <- 1:length(obs_vars)
- names(col_obs) <- names(pch_obs) <- obs_vars
+ col_obs <- pch_obs <- 1:length(obs_vars)
+ names(col_obs) <- names(pch_obs) <- obs_vars
plot(0, type = "n",
xlab = xlab, ylab = ylab,
xlim = xlim,
ylim = c(-1.2 * maxabs, 1.2 * maxabs), ...)
- for(obs_var in obs_vars){
- residuals_plot <- subset(object$data, variable == obs_var, c("time", "residual"))
- points(residuals_plot, pch = pch_obs[obs_var], col = col_obs[obs_var])
- }
+ for(obs_var in obs_vars){
+ residuals_plot <- subset(object$data, variable == obs_var, c("time", "residual"))
+ points(residuals_plot, pch = pch_obs[obs_var], col = col_obs[obs_var])
+ }
abline(h = 0, lty = 2)

Contact - Imprint