diff options
author | ranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4> | 2006-05-11 15:53:07 +0000 |
---|---|---|
committer | ranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4> | 2006-05-11 15:53:07 +0000 |
commit | 6d118690c0cae02fc5cd4b28c1a67eecde4d9f60 (patch) | |
tree | 8f923f7623604f78bd5a7228d413fdd2f0971010 | |
parent | 513dfbdcdda94a901b5901b486ff5500c7d158b1 (diff) |
- The vignette is in a publisheable state
- In addition to the Massart examples, the sample data from dintest (DIN 32645)
has been tested
- inverse.predict and calplot now also work on glm objects
git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/chemCal@7 5fad18fb-23f0-0310-ab10-e59a3bee62b4
-rw-r--r-- | DESCRIPTION | 13 | ||||
-rw-r--r-- | INDEX | 2 | ||||
-rw-r--r-- | R/inverse.predict.lm.R | 43 | ||||
-rw-r--r-- | data/draper.R | 5 | ||||
-rw-r--r-- | inst/doc/Makefile | 12 | ||||
-rw-r--r-- | inst/doc/chemCal-001.pdf | 4 | ||||
-rw-r--r-- | inst/doc/chemCal.Rnw | 31 | ||||
-rw-r--r-- | inst/doc/chemCal.aux | 1 | ||||
-rw-r--r-- | inst/doc/chemCal.log | 83 | ||||
-rw-r--r-- | inst/doc/chemCal.pdf | bin | 105421 -> 107614 bytes | |||
-rw-r--r-- | inst/doc/chemCal.tex | 127 | ||||
-rw-r--r-- | man/calplot.lm.Rd | 5 | ||||
-rw-r--r-- | man/chemCal-package.Rd | 17 | ||||
-rw-r--r-- | man/din32645.Rd | 16 | ||||
-rw-r--r-- | man/draper.Rd | 9 | ||||
-rw-r--r-- | man/inverse.predict.Rd | 6 |
16 files changed, 263 insertions, 111 deletions
diff --git a/DESCRIPTION b/DESCRIPTION index 556600c..963c663 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,12 +1,17 @@ Package: chemCal -Version: 0.05-6 -Date: 2006-05-09 +Version: 0.05-7 +Date: 2006-05-11 Title: Calibration functions for analytical chemistry Author: Johannes Ranke <jranke@uni-bremen.de> Maintainer: Johannes Ranke <jranke@uni-bremen.de> Depends: R -Description: chemCal provides simple functions for plotting - calibration functions and for estimating standard errors for measurements. +Suggests: MASS +Description: chemCal provides simple functions for plotting linear + calibration functions and for estimating standard errors for measurements + according to the Handbook of Chemometrics and Qualimetrics: Part A + by Massart et al. + The functions work on model objects from - optionally weighted - linear + regression (lm) or robust linear regression (rlm from the MASS package). License: GPL version 2 or newer URL: http://www.r-project.org, http://www.uft.uni-bremen.de/chemie/ranke, @@ -1,7 +1,7 @@ calplot Plot calibration graphs from univariate linear models +chemCal-package Calibration functions for analytical chemistry din32645 Calibration data from DIN 32645 -draper Regression example with repeated measurements inverse.predict Predict x from y for a linear calibration massart97ex3 Calibration data from Massart et al. (1997), example 3 diff --git a/R/inverse.predict.lm.R b/R/inverse.predict.lm.R index f1921e4..f09dc3e 100644 --- a/R/inverse.predict.lm.R +++ b/R/inverse.predict.lm.R @@ -20,6 +20,27 @@ inverse.predict.lm <- function(object, newdata, ws = ifelse(length(object$weights) > 0, mean(object$weights), 1), alpha=0.05, ss = "auto") { + if (length(object$weights) > 0) { + wx <- split(object$model$y,object$model$x) + w <- sapply(wx,mean) + } else { + w <- rep(1,length(split(object$model$y,object$model$x))) + } + .inverse.predict(object, newdata, ws, alpha, ss, w) +} + +inverse.predict.rlm <- function(object, newdata, + ws = mean(object$w), alpha=0.05, ss = "auto") +{ + wx <- split(object$weights,object$model$x) + w <- sapply(wx,mean) + .inverse.predict(object, newdata, ws, alpha, ss, w) +} + +.inverse.predict <- function(object, newdata, + ws = ifelse(length(object$weights) > 0, mean(object$weights), 1), + alpha=0.05, ss = "auto", w) +{ if (length(object$coef) > 2) stop("More than one independent variable in your model - not implemented") @@ -33,12 +54,6 @@ inverse.predict.lm <- function(object, newdata, n <- length(yx) x <- as.numeric(names(yx)) ybar <- sapply(yx,mean) - if (length(object$weights) > 0) { - wx <- split(object$weights,object$model$x) - w <- sapply(wx,mean) - } else { - w <- rep(1,n) - } yhatx <- split(object$fitted.values,object$model$x) yhat <- sapply(yhatx,mean) se <- sqrt(sum(w*(ybar - yhat)^2)/(n-2)) @@ -52,21 +67,7 @@ inverse.predict.lm <- function(object, newdata, ybarw <- sum(w * ybar)/sum(w) -# The commented out code for sxhats is equation 8.28 without changes. It has -# been replaced by the code below, in order to be able to take into account a -# precision in the sample measurements that differs from the precision in the -# calibration samples. - -# sxhats <- se/b1 * sqrt( -# 1/(ws * m) + -# 1/sum(w) + -# (ybars - ybarw)^2 * sum(w) / -# (b1^2 * (sum(w) * sum(w * x^2) - sum(w * x)^2)) -# ) - -# This is equation 8.28, but with the possibility to take into account a -# different precision measurement of the sample and standard solutions -# in analogy to equation 8.26 +# This is an adapted form of equation 8.28 (see package vignette) sxhats <- 1/b1 * sqrt( ss^2/(ws * m) + se^2 * (1/sum(w) + diff --git a/data/draper.R b/data/draper.R deleted file mode 100644 index 5aa7ae9..0000000 --- a/data/draper.R +++ /dev/null @@ -1,5 +0,0 @@ -"draper" <- -structure(list(x=c(1.3, 1.3, 2.0, 2.0, 2.7, 3.3, 3.3, 3.7, 3.7, 4.0, -4.0, 4.0, 4.7, 4.7, 4.7, 5.0, 5.3, 5.3, 5.3, 5.7, 6.0, 6.0, 6.3, 6.7), -y=c(2.3, 1.8, 2.8, 1.5, 2.2, 3.8, 1.8, 3.7, 1.7, 2.8, 2.8, 2.2, 5.4, -3.2, 1.9, 1.8, 3.5, 2.8, 2.1, 3.4, 3.2, 3.0, 3.0, 5.9))) diff --git a/inst/doc/Makefile b/inst/doc/Makefile index 637b193..26fe678 100644 --- a/inst/doc/Makefile +++ b/inst/doc/Makefile @@ -1,6 +1,6 @@ # Makefile for Sweave documents containing both Latex and R code # Author: Johannes Ranke <jranke@uni-bremen.de> -# Last Change: 2006 Mai 10 +# Last Change: 2006 Mai 11 # based on the Makefile of Nicholas Lewin-Koh # in turn based on work of Rouben Rostmaian # SVN: $Id: Makefile.rnoweb 50 2006-04-18 11:13:52Z ranke $ @@ -14,14 +14,8 @@ TARGETS = $(patsubst %.Rnw,%.tex,$(RNWFILE)) $(patsubst %.Rnw,%.pdf,$(RNWFILES)) %.pdf: %.tex pdflatex $< -all: all-recursive $(TARGETS) +all: $(TARGETS) -clean: clean-recursive +clean: rm -f *.aux *.log *.bbl *.blg *.brf *.cb *.ind *.idx *.ilg \ *.inx *.ps *.dvi *.toc *.out *.lot *~ *.lof *.ttt *.fff - -all-recursive: - for dir in $(wildcard *); do if [ -d $$dir ] && [ -f $$dir/Makefile ]; then cd $$dir; $(MAKE) all; cd ..; fi; done - -clean-recursive: - for dir in $(wildcard *); do if [ -d $$dir ] && [ -f $$dir/Makefile ]; then cd $$dir; $(MAKE) clean; cd ..; fi; done diff --git a/inst/doc/chemCal-001.pdf b/inst/doc/chemCal-001.pdf index e5c8f5f..6e2f9b8 100644 --- a/inst/doc/chemCal-001.pdf +++ b/inst/doc/chemCal-001.pdf @@ -2,8 +2,8 @@ %ρ\r 1 0 obj << -/CreationDate (D:20060510174125) -/ModDate (D:20060510174125) +/CreationDate (D:20060511175039) +/ModDate (D:20060511175039) /Title (R Graphics Output) /Producer (R 2.3.0) /Creator (R) diff --git a/inst/doc/chemCal.Rnw b/inst/doc/chemCal.Rnw index 2c902ab..26b224f 100644 --- a/inst/doc/chemCal.Rnw +++ b/inst/doc/chemCal.Rnw @@ -20,7 +20,7 @@ inverse prediction method given in \cite{massart97} would be implemented, since it also covers the case of weighted regression. At the moment, the package only consists of two functions, working -on univariate linear models of class \texttt{lm}. +on univariate linear models of class \texttt{lm} or \texttt{rlm}. When calibrating an analytical method, the first task is to generate a suitable model. If we want to use the \chemCal{} functions, we @@ -59,9 +59,9 @@ given by the user in the case of weighted regression. By default, the mean of the weights used in the linear regression is used. \section*{Theory} -Equation 8.28 in \cite{massart97} gives a general equation for predicting x -from measurements of y according to the linear calibration function -$ y = b_0 + b_1 \cdot x$: +Equation 8.28 in \cite{massart97} gives a general equation for predicting the +standard error $s_{\hat{x_s}}$ for an x value predicted from measurements of y +according to the linear calibration function $ y = b_0 + b_1 \cdot x$: \begin{equation} s_{\hat{x_s}} = \frac{s_e}{b_1} \sqrt{\frac{1}{w_s m} + \frac{1}{\sum{w_i}} + @@ -72,9 +72,30 @@ s_{\hat{x_s}} = \frac{s_e}{b_1} \sqrt{\frac{1}{w_s m} + \frac{1}{\sum{w_i}} + with \begin{equation} -s_e = \sqrt{ \frac{\sum w_i (y_i - \hat{y})^2}{n - 2}} +s_e = \sqrt{ \frac{\sum w_i (y_i - \hat{y_i})^2}{n - 2}} \end{equation} +where $w_i$ is the weight for calibration standard $i$, $y_i$ is the mean $y$ +value (!) observed for standard $i$, $\hat{y_i}$ is the estimated value for +standard $i$, $n$ is the number calibration standards, $w_s$ is the weight +attributed to the sample $s$, $m$ is the number of replicate measurements of +sample $s$, $\bar{y_s}$ is the mean response for the sample, +$\bar{y_w} = \frac{\sum{w_i y_i}}{\sum{w_i}}$ is the weighted mean of responses +$y_i$, and $x_i$ is the given $x$ value for standard $i$. + +The weight $w_s$ for the sample should be estimated or calculated in accordance +to the weights used in the linear regression. + +I adjusted the above equation in order to be able to take a different precisions +in standards and samples into account. In analogy to Equation 8.26 from \cite{massart97} +we get + +\begin{equation} +s_{\hat{x_s}} = \frac{1}{b_1} \sqrt{\frac{{s_s}^2}{w_s m} + + {s_e}^2 \left( \frac{1}{\sum{w_i}} + + \frac{(\bar{y_s} - \bar{y_w})^2 \sum{w_i}} + {{b_1}^2 \left( \sum{w_i} \sum{w_i {x_i}^2} - {\left( \sum{ w_i x_i } \right)}^2 \right) } \right) } +\end{equation} \begin{thebibliography}{1} \bibitem{massart97} diff --git a/inst/doc/chemCal.aux b/inst/doc/chemCal.aux index 0eb51cc..20bfc98 100644 --- a/inst/doc/chemCal.aux +++ b/inst/doc/chemCal.aux @@ -14,4 +14,5 @@ \citation{massart97} \citation{massart97} \citation{massart97} +\citation{massart97} \bibcite{massart97}{1} diff --git a/inst/doc/chemCal.log b/inst/doc/chemCal.log index fadbc89..805f382 100644 --- a/inst/doc/chemCal.log +++ b/inst/doc/chemCal.log @@ -1,4 +1,4 @@ -This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) (format=pdflatex 2006.4.5) 10 MAY 2006 17:41 +This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) (format=pdflatex 2006.4.5) 11 MAY 2006 17:50 entering extended mode **chemCal.tex (./chemCal.tex @@ -129,7 +129,7 @@ Style option: `fancyvrb' v2.6, with DG/SPQR fixes <1998/07/17> (tvz) \FV@OutFile=\write4 No file fancyvrb.cfg. -) (/usr/share/texmf-tetex/tex/latex/upquote/upquote.sty +) (/usr/share/R/share/texmf/upquote.sty Package: upquote 2003/08/11 v1.1 Covington's upright-quote modification to verb atim and verb @@ -301,64 +301,49 @@ LaTeX Font Info: Try loading font information for T1+aett on input line 16. (/usr/share/texmf-tetex/tex/latex/ae/t1aett.fd File: t1aett.fd 1997/11/16 Font definitions for T1/aett. ) - -LaTeX Warning: Citation `massart97' on page 1 undefined on input line 20. - <chemCal-001.pdf, id=7, 433.62pt x 433.62pt> File: chemCal-001.pdf Graphic file (type pdf) <use chemCal-001.pdf> [1 {/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] - -LaTeX Warning: Citation `massart97' on page 2 undefined on input line 50. - LaTeX Font Info: Try loading font information for TS1+aett on input line 65. -LaTeX Font Info: No file TS1aett.fd. on input line 65. - -LaTeX Font Warning: Font shape `TS1/aett/m/n' undefined -(Font) using `TS1/cmr/m/n' instead -(Font) for symbol `textasciigrave' on input line 65. - - -LaTeX Warning: Citation `massart97' on page 2 undefined on input line 81. + (/usr/share/R/share/texmf/ts1aett.fd +File: ts1aett.fd +) +LaTeX Font Info: Try loading font information for TS1+cmtt on input line 65. + (/usr/share/texmf-tetex/tex/latex/base/ts1cmtt.fd +File: ts1cmtt.fd 1999/05/25 v2.5h Standard LaTeX font definitions +) +LaTeX Font Info: Font shape `TS1/aett/m/n' in size <10> not available +(Font) Font shape `TS1/cmtt/m/n' tried instead on input line 65. LaTeX Font Info: External font `cmex10' loaded for size -(Font) <7> on input line 83. +(Font) <7> on input line 82. LaTeX Font Info: External font `cmex10' loaded for size -(Font) <5> on input line 83. -[2 <./chemCal-001.pdf>] [3] (./chemCal.aux) - -LaTeX Font Warning: Some font shapes were not available, defaults substituted. - - -LaTeX Warning: There were undefined references. - - -LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. - - ) +(Font) <5> on input line 82. + [2 <./chemCal-001.pdf>] +[3] (./chemCal.aux) ) Here is how much of TeX's memory you used: - 3752 strings out of 94499 - 51374 string characters out of 1175814 - 95260 words of memory out of 1000000 - 6850 multiletter control sequences out of 10000+50000 - 24598 words of font info for 57 fonts, out of 500000 for 2000 + 3764 strings out of 94499 + 51832 string characters out of 1175814 + 96290 words of memory out of 1000000 + 6863 multiletter control sequences out of 10000+50000 + 21774 words of font info for 52 fonts, out of 500000 for 2000 580 hyphenation exceptions out of 8191 - 35i,6n,21p,255b,255s stack positions out of 1500i,500n,5000p,200000b,5000s + 35i,7n,21p,255b,273s stack positions out of 1500i,500n,5000p,200000b,5000s PDF statistics: - 70 PDF objects out of 300000 - 9 named destinations out of 131072 + 72 PDF objects out of 300000 + 10 named destinations out of 131072 22 words of extra memory for PDF output out of 65536 -</usr/share/texmf-tetex/fonts/type1/bluesky/cm/cmex10.pfb></usr/share/texmf-t -etex/fonts/type1/bluesky/cm/cmmi5.pfb></usr/share/texmf-tetex/fonts/type1/blues -ky/cm/cmmi7.pfb></usr/share/texmf-tetex/fonts/type1/bluesky/cm/cmsy10.pfb></usr -/share/texmf-tetex/fonts/type1/bluesky/cm/cmr7.pfb></usr/share/texmf-tetex/font -s/type1/bluesky/cm/cmmi10.pfb></usr/share/texmf-tetex/fonts/type1/bluesky/cm/cm -bx12.pfb> </var/cache/fonts/pk/ljfour/jknappen/tc/tcrm1000.600pk></usr/share/te -xmf-tetex/fonts/type1/bluesky/cm/cmsltt10.pfb></usr/share/texmf-tetex/fonts/typ -e1/bluesky/cm/cmbx10.pfb></usr/share/texmf-tetex/fonts/type1/bluesky/cm/cmtt10. -pfb></usr/share/texmf-tetex/fonts/type1/bluesky/cm/cmr10.pfb></usr/share/texmf- -tetex/fonts/type1/bluesky/cm/cmr12.pfb></usr/share/texmf-tetex/fonts/type1/blue -sky/cm/cmr17.pfb> -Output written on chemCal.pdf (3 pages, 105421 bytes). +</usr/share/texmf-tetex/fonts/type1/bluesky/cm/cmex10.pfb> +</usr/share/texmf-tetex/fonts/type1/bluesky/cm/cmsy10.pfb></usr/share/texmf-tet +ex/fonts/type1/bluesky/cm/cmmi5.pfb></usr/share/texmf-tetex/fonts/type1/bluesky +/cm/cmmi7.pfb></usr/share/texmf-tetex/fonts/type1/bluesky/cm/cmr7.pfb></usr/sha +re/texmf-tetex/fonts/type1/bluesky/cm/cmmi10.pfb></usr/share/texmf-tetex/fonts/ +type1/bluesky/cm/cmbx12.pfb> </var/cache/fonts/pk/ljfour/jknappen/tc/tctt1000.6 +00pk></usr/share/texmf-tetex/fonts/type1/bluesky/cm/cmsltt10.pfb></usr/share/te +xmf-tetex/fonts/type1/bluesky/cm/cmtt10.pfb></usr/share/texmf-tetex/fonts/type1 +/bluesky/cm/cmr10.pfb></usr/share/texmf-tetex/fonts/type1/bluesky/cm/cmr12.pfb> +</usr/share/texmf-tetex/fonts/type1/bluesky/cm/cmr17.pfb> +Output written on chemCal.pdf (3 pages, 107614 bytes). diff --git a/inst/doc/chemCal.pdf b/inst/doc/chemCal.pdf Binary files differindex b0da323..e3c6a8c 100644 --- a/inst/doc/chemCal.pdf +++ b/inst/doc/chemCal.pdf diff --git a/inst/doc/chemCal.tex b/inst/doc/chemCal.tex new file mode 100644 index 0000000..a4b4459 --- /dev/null +++ b/inst/doc/chemCal.tex @@ -0,0 +1,127 @@ +\documentclass[a4paper]{article} +%\VignetteIndexEntry{Short manual for the chemCal package} +\newcommand{\chemCal}{{\tt chemCal}} +\newcommand{\calplot}{{\tt calplot}} +\newcommand{\calpredict}{{\tt calpredict}} +\newcommand{\R}{{\tt R}} +\usepackage{hyperref} + +\title{Basic calibration functions for analytical chemistry} +\author{Johannes Ranke} + +\usepackage{/usr/share/R/share/texmf/Sweave} +\begin{document} +\maketitle + +The \chemCal{} package was first designed in the course of a lecture and lab +course on "analytics of organic trace contaminants" at the University of Bremen +from October to December 2004. In the fall 2005, an email exchange with +Ron Wehrens led to the belief that it could be heavily improved if the +inverse prediction method given in \cite{massart97} would be implemented, +since it also covers the case of weighted regression. + +At the moment, the package only consists of two functions, working +on univariate linear models of class \texttt{lm} or \texttt{rlm}. + +When calibrating an analytical method, the first task is to generate +a suitable model. If we want to use the \chemCal{} functions, we +will have to restrict ourselves to univariate, possibly weighted, linear +regression so far. + +Once such a model has been created, the calibration can be graphically +shown by using the \texttt{calplot} function: + +\begin{Schunk} +\begin{Sinput} +> library(chemCal) +> data(massart97ex3) +> attach(massart97ex3) +> yx <- split(y, factor(x)) +> ybar <- sapply(yx, mean) +> s <- round(sapply(yx, sd), digits = 2) +> w <- round(1/(s^2), digits = 3) +> weights <- w[factor(x)] +> m <- lm(y ~ x, w = weights) +> calplot(m) +\end{Sinput} +\end{Schunk} +\includegraphics{chemCal-001} + +This is a reproduction of Example 8 in \cite{massart97}. We can +see the influence of the weighted regression on the confidence +and prediction bands of the calibration. + +If we now want to predict a new x value from measured y values, +we use the \texttt{inverse.predict} function: + +\begin{Schunk} +\begin{Sinput} +> inverse.predict(m, 15, ws = 1.67) +\end{Sinput} +\begin{Soutput} +$Prediction +[1] 5.865367 + +$`Standard Error` +[1] 10.66054 + +$Confidence +[1] 29.59840 + +$`Confidence Limits` +[1] -23.73303 35.46376 +\end{Soutput} +\end{Schunk} + +The weight \texttt{ws} assigned to the measured y value has to be +given by the user in the case of weighted regression. By default, +the mean of the weights used in the linear regression is used. + +\section*{Theory} +Equation 8.28 in \cite{massart97} gives a general equation for predicting the +standard error $s_{\hat{x_s}}$ for an x value predicted from measurements of y +according to the linear calibration function $ y = b_0 + b_1 \cdot x$: + +\begin{equation} +s_{\hat{x_s}} = \frac{s_e}{b_1} \sqrt{\frac{1}{w_s m} + \frac{1}{\sum{w_i}} + + \frac{(\bar{y_s} - \bar{y_w})^2 \sum{w_i}} + {{b_1}^2 \left( \sum{w_i} \sum{w_i {x_i}^2} - {\left( \sum{ w_i x_i } \right)}^2 \right) }} +\end{equation} + +with + +\begin{equation} +s_e = \sqrt{ \frac{\sum w_i (y_i - \hat{y_i})^2}{n - 2}} +\end{equation} + +where $w_i$ is the weight for calibration standard $i$, $y_i$ is the mean $y$ +value (!) observed for standard $i$, $\hat{y_i}$ is the estimated value for +standard $i$, $n$ is the number calibration standards, $w_s$ is the weight +attributed to the sample $s$, $m$ is the number of replicate measurements of +sample $s$, $\bar{y_s}$ is the mean response for the sample, +$\bar{y_w} = \frac{\sum{w_i y_i}}{\sum{w_i}}$ is the weighted mean of responses +$y_i$, and $x_i$ is the given $x$ value for standard $i$. + +The weight $w_s$ for the sample should be estimated or calculated in accordance +to the weights used in the linear regression. + +I adjusted the above equation in order to be able to take a different precisions +in standards and samples into account. In analogy to Equation 8.26 from \cite{massart97} +we get + +\begin{equation} +s_{\hat{x_s}} = \frac{1}{b_1} \sqrt{\frac{{s_s}^2}{w_s m} + + {s_e}^2 \left( \frac{1}{\sum{w_i}} + + \frac{(\bar{y_s} - \bar{y_w})^2 \sum{w_i}} + {{b_1}^2 \left( \sum{w_i} \sum{w_i {x_i}^2} - {\left( \sum{ w_i x_i } \right)}^2 \right) } \right) } +\end{equation} + +\begin{thebibliography}{1} +\bibitem{massart97} +Massart, L.M, Vandenginste, B.G.M., Buydens, L.M.C., De Jong, S., Lewi, P.J., +Smeyers-Verbeke, J. +\newblock Handbook of Chemometrics and Qualimetrics: Part A, +\newblock Elsevier, Amsterdam, 1997 +\end{thebibliography} + +\end{document} diff --git a/man/calplot.lm.Rd b/man/calplot.lm.Rd index c2b8116..efdea3d 100644 --- a/man/calplot.lm.Rd +++ b/man/calplot.lm.Rd @@ -13,8 +13,9 @@ } \arguments{ \item{object}{ - A univariate model object of class \code{\link{lm}} with model formula - \code{y ~ x} or \code{y ~ x - 1}. + A univariate model object of class \code{\link{lm}} or + \code{\link[MASS:rlm]{rlm}} + with model formula \code{y ~ x} or \code{y ~ x - 1}. } \item{xlim}{ The limits of the plot on the x axis. diff --git a/man/chemCal-package.Rd b/man/chemCal-package.Rd new file mode 100644 index 0000000..a11744e --- /dev/null +++ b/man/chemCal-package.Rd @@ -0,0 +1,17 @@ +\name{chemCal-package} +\alias{chemCal-package} +\docType{package} +\title{ +Calibration functions for analytical chemistry +} +\description{ +See \url{../DESCRIPTION} +} +\details{ +There is a package vignette located in \url{../doc/chemCal.pdf}. +} +\author{ +Author and Maintainer: Johannes Ranke <jranke@uni-bremen.de> +} +\keyword{manip} +} diff --git a/man/din32645.Rd b/man/din32645.Rd index 0a2a790..1a3c046 100644 --- a/man/din32645.Rd +++ b/man/din32645.Rd @@ -9,7 +9,19 @@ \format{ A dataframe containing 10 rows of x and y values. } -\source{ - \url{http://www.uft.uni-bremen.de/chemie} +\examples{ +data(din32645) +m <- lm(y ~ x, data=din32645) +calplot(m) +prediction <- inverse.predict(m,3500,alpha=0.01) +# This should give 0.074 according to DIN (cited from the Dintest test data) +round(prediction$Confidence,3) +} +\references{ + DIN 32645 (equivalent to ISO 11843) + + Dintest. Plugin for MS Excel for evaluations of calibration data. Written + by Georg Schmitt, University of Heidelberg. + \url{http://www.rzuser.uni-heidelberg.de/~df6/download/dintest.htm} } \keyword{datasets} diff --git a/man/draper.Rd b/man/draper.Rd deleted file mode 100644 index 6a8de00..0000000 --- a/man/draper.Rd +++ /dev/null @@ -1,9 +0,0 @@ -\name{draper} -\alias{draper} -\title{Regression example with repeated measurements} -\usage{data(draper)} -\references{Draper and Smith, Applied Regression Analysis (1981), p. 38} -\format{A dataframe with 24 observations on 2 variables} -\description{An example of a regression with multiple measurements per -factor level.} -\keyword{datasets} diff --git a/man/inverse.predict.Rd b/man/inverse.predict.Rd index 48534c4..d773e58 100644 --- a/man/inverse.predict.Rd +++ b/man/inverse.predict.Rd @@ -1,6 +1,7 @@ \name{inverse.predict} \alias{inverse.predict} \alias{inverse.predict.lm} +\alias{inverse.predict.rlm} \alias{inverse.predict.default} \title{Predict x from y for a linear calibration} \usage{inverse.predict(object, newdata, @@ -9,8 +10,9 @@ } \arguments{ \item{object}{ - A univariate model object of class \code{\link{lm}} with model formula - \code{y ~ x} or \code{y ~ x - 1}. + A univariate model object of class \code{\link{lm}} or + \code{\link[MASS:rlm]{rlm}} + with model formula \code{y ~ x} or \code{y ~ x - 1}. } \item{newdata}{ A vector of observed y values for one sample. |