From 9e0dae397df8c18e7333d2604cae96b2a7927420 Mon Sep 17 00:00:00 2001 From: ranke Date: Fri, 23 Jun 2006 15:33:27 +0000 Subject: - inverse.predict now has a var.s argument instead of the never tested ss argument. This is documented in the updated vignette - loq() now has w.loq and var.loq arguments, and stops with a message if neither are specified and the model has weights. - calplot doesn't stop any more for weighted regression models, but only refrains from drawing prediction bands - Added method = "din" to lod(), now that I actually have it (DIN 32645) and was able to see which approximation is used therein. - removed the demos, as the examples and tests are already partially duplicated - The vignette is more of a collection of various notes, but should certainly be helpful for the user. - Version bump to 0.1-xxx git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/chemCal@16 5fad18fb-23f0-0310-ab10-e59a3bee62b4 --- R/calplot.R | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'R/calplot.R') diff --git a/R/calplot.R b/R/calplot.R index 0cc6120..6aed9c0 100644 --- a/R/calplot.R +++ b/R/calplot.R @@ -1,6 +1,6 @@ calplot <- function(object, - xlim = c("auto","auto"), ylim = c("auto","auto"), - xlab = "Concentration", ylab = "Response", alpha=0.05, + xlim = c("auto", "auto"), ylim = c("auto", "auto"), + xlab = "Concentration", ylab = "Response", alpha = 0.05, varfunc = NULL) { UseMethod("calplot") @@ -22,14 +22,6 @@ calplot.lm <- function(object, if (length(object$coef) > 2) stop("More than one independent variable in your model - not implemented") - if (length(object$weights) > 0) { - stop(paste( - "\nConfidence and prediction intervals for weighted linear models require", - "weights for the x values from which the predictions are to be generated.", - "This is not supported by the internally used predict.lm method.", - sep = "\n")) - } - if (alpha <= 0 | alpha >= 1) stop("Alpha should be between 0 and 1 (exclusive)") @@ -65,9 +57,17 @@ calplot.lm <- function(object, points(x,y, pch = 21, bg = "yellow") matlines(newdata[[1]], pred.lim, lty = c(1, 4, 4), col = c("black", "red", "red")) + if (length(object$weights) > 0) { + legend(min(x), + max(pred.lim, na.rm = TRUE), + legend = c("Fitted Line", "Confidence Bands"), + lty = c(1, 3), + lwd = 2, + col = c("black", "green4"), + horiz = FALSE, cex = 0.9, bg = "gray95") + } else { matlines(newdata[[1]], conf.lim, lty = c(1, 3, 3), col = c("black", "green4", "green4")) - legend(min(x), max(pred.lim, na.rm = TRUE), legend = c("Fitted Line", "Confidence Bands", @@ -76,4 +76,5 @@ calplot.lm <- function(object, lwd = 2, col = c("black", "green4", "red"), horiz = FALSE, cex = 0.9, bg = "gray95") + } } -- cgit v1.2.1