aboutsummaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4>2006-05-10 15:44:14 +0000
committerranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4>2006-05-10 15:44:14 +0000
commit513dfbdcdda94a901b5901b486ff5500c7d158b1 (patch)
treefefbf7daadbd7da71add3ed63b3d3b07c4c8e4df /man
parent8d30b2cd951c992e4f9aa3055054091e18b8b4f0 (diff)
The inverse prediction works in a variety of cases and is
tested with Examples 7 and 8 from Massart! I need to compare with the DIN and draper examples, and finish the package vignette. git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/chemCal@6 5fad18fb-23f0-0310-ab10-e59a3bee62b4
Diffstat (limited to 'man')
-rw-r--r--man/calm.Rd43
-rw-r--r--man/calplot.lm.Rd55
-rw-r--r--man/draper.Rd9
-rw-r--r--man/inverse.predict.Rd65
-rw-r--r--man/plot.calm.Rd48
-rw-r--r--man/predictx.Rd37
6 files changed, 129 insertions, 128 deletions
diff --git a/man/calm.Rd b/man/calm.Rd
deleted file mode 100644
index c16f663..0000000
--- a/man/calm.Rd
+++ /dev/null
@@ -1,43 +0,0 @@
-\name{calm}
-\alias{calm}
-\alias{print.calm}
-\alias{predict.calm}
-\alias{summary.calm}
-\title{Generate a calibration model}
-\description{
- This function fits a calibration model to the data
- frame.
-}
-\usage{
- calm(data)
-}
-\arguments{
- \item{data}{
- A data frame with numeric x data in the first column and
- numeric y data in the second column.
- }
-}
-\value{
- An object of class \code{calm}, which is derived from
- a linear model \code{lm}, the only difference being that
- it contains the additional attributes \code{xname},
- \code{yname} and \code{intercept}, the latter being a
- boolean reporting wether the model uses an intercept or not.
-}
-\note{
- The decision if the returned model contains an intercept is taken based on
- the significance of the fitted intercept on a significance level of 0.95.
- The methods \code{\link{print.calm}}, \code{\link{predict.calm}}
- \code{\link{summary.calm}} are just newly assigned names for the
- corresponding methods from the class \code{\link{lm}}.
-}
-\examples{
- data(din32645)
- calm(din32645)
-}
-\author{
- Johannes Ranke
- \email{jranke@uni-bremen.de}
- \url{http://www.uft.uni-bremen.de/chemie/ranke}
-}
-\keyword{regression}
diff --git a/man/calplot.lm.Rd b/man/calplot.lm.Rd
new file mode 100644
index 0000000..c2b8116
--- /dev/null
+++ b/man/calplot.lm.Rd
@@ -0,0 +1,55 @@
+\name{calplot}
+\alias{calplot}
+\alias{calplot.default}
+\alias{calplot.lm}
+\title{Plot calibration graphs from univariate linear models}
+\description{
+ Produce graphics of calibration data, the fitted model as well
+ as prediction and confidence bands.
+}
+\usage{
+ calplot(object, xlim = "auto", ylim = "auto",
+ xlab = "Concentration", ylab = "Response", alpha=0.05)
+}
+\arguments{
+ \item{object}{
+ A univariate model object of class \code{\link{lm}} with model formula
+ \code{y ~ x} or \code{y ~ x - 1}.
+ }
+ \item{xlim}{
+ The limits of the plot on the x axis.
+ }
+ \item{ylim}{
+ The limits of the plot on the y axis.
+ }
+ \item{xlab}{
+ The label of the x axis.
+ }
+ \item{ylab}{
+ The label of the y axis.
+ }
+ \item{alpha}{
+ The confidence level for the confidence and prediction bands.
+ }
+}
+\value{
+ A plot of the calibration data, of your fitted model as well as lines showing
+ the confidence limits as well as the prediction limits.
+}
+\examples{
+# Example of a Calibration plot for a weighted regression
+data(massart97ex3)
+attach(massart97ex3)
+yx <- split(y,factor(x))
+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)
+}
+\author{
+ Johannes Ranke
+ \email{jranke@uni-bremen.de}
+ \url{http://www.uft.uni-bremen.de/chemie/ranke}
+}
+\keyword{regression}
diff --git a/man/draper.Rd b/man/draper.Rd
new file mode 100644
index 0000000..6a8de00
--- /dev/null
+++ b/man/draper.Rd
@@ -0,0 +1,9 @@
+\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
new file mode 100644
index 0000000..48534c4
--- /dev/null
+++ b/man/inverse.predict.Rd
@@ -0,0 +1,65 @@
+\name{inverse.predict}
+\alias{inverse.predict}
+\alias{inverse.predict.lm}
+\alias{inverse.predict.default}
+\title{Predict x from y for a linear calibration}
+\usage{inverse.predict(object, newdata,
+ ws = ifelse(length(object$weights) > 0, mean(object$weights), 1),
+ alpha=0.05, ss = "auto")
+}
+\arguments{
+ \item{object}{
+ A univariate model object of class \code{\link{lm}} with model formula
+ \code{y ~ x} or \code{y ~ x - 1}.
+ }
+ \item{newdata}{
+ A vector of observed y values for one sample.
+ }
+ \item{ws}{
+ The weight attributed to the sample. The default is to take the
+ mean of the weights in the model, if there are any.
+ }
+ \item{alpha}{
+ The confidence level for the confidence interval to be reported.
+ }
+ \item{ss}{
+ The estimated standard error of the sample measurements. The
+ default is to take the residual standard error from the calibration.
+ }
+}
+\value{
+ A list containing the predicted x value, its standard error and a
+ confidence interval.
+}
+\description{
+ This function predicts x values using a univariate linear model that has been
+ generated for the purpose of calibrating a measurement method. Prediction
+ intervals are given at the specified confidence level.
+ The calculation method was taken from Massart et al. (1997). In particular,
+ Equations 8.26 and 8.28 were combined in order to yield a general treatment
+ of inverse prediction for univariate linear models, taking into account
+ weights that have been used to create the linear model, and at the same
+ time providing the possibility to specify a precision in sample measurements
+ differing from the precision in standard samples used for the calibration.
+ This is elaborated in the package vignette.
+}
+\note{
+ The function was validated with examples 7 and 8 from Massart et al. (1997).
+}
+\references{
+ Massart, L.M, Vandenginste, B.G.M., Buydens, L.M.C., De Jong, S., Lewi, P.J.,
+ Smeyers-Verbeke, J. (1997) Handbook of Chemometrics and Qualimetrics: Part A,
+ p. 200
+}
+\examples{
+data(massart97ex3)
+attach(massart97ex3)
+yx <- split(y,factor(x))
+s <- round(sapply(yx,sd),digits=2)
+w <- round(1/(s^2),digits=3)
+weights <- w[factor(x)]
+m <- lm(y ~ x,w=weights)
+
+inverse.predict(m,c(15))
+}
+\keyword{manip}
diff --git a/man/plot.calm.Rd b/man/plot.calm.Rd
deleted file mode 100644
index bb302c7..0000000
--- a/man/plot.calm.Rd
+++ /dev/null
@@ -1,48 +0,0 @@
-\name{plot.calm}
-\alias{plot.calm}
-\title{Plot calibration graphs from calibration models}
-\description{
- Produce graphics of calibration data, the fitted model as well
- as prediction and confidence intervals.
-}
-\usage{
- plot.calm(x,...,xunit="",yunit="",measurand="",level=0.95)
-}
-\arguments{
- \item{x}{
- A calibration model of type \code{\link{calm}}. It is named
- x here because the generic plot method expects x to be its
- first argument.
- }
- \item{...}{
- I just included this because I wanted to avoid the error messages
- from R CMD check that tell me I should read "Writing R extensions"
- which I did ...
- }
- \item{xunit}{
- The unit of the given values on the x axis as a character vector.
- }
- \item{yunit}{
- The unit of the y axis as a character vector.
- }
- \item{measurand}{
- The name of what is being measured as a character vector.
- }
- \item{level}{
- The confidence level of the confidence and prediction bands. Defaults to
- 0.95.
- }
-}
-\value{
- A plot of the calibration data, of your fitted model as well as lines showing
- the confidence limits and the prediction limits.
-}
-\examples{
-
-}
-\author{
- Johannes Ranke
- \email{jranke@uni-bremen.de}
- \url{http://www.uft.uni-bremen.de/chemie/ranke}
-}
-\keyword{regression}
diff --git a/man/predictx.Rd b/man/predictx.Rd
deleted file mode 100644
index a3946b0..0000000
--- a/man/predictx.Rd
+++ /dev/null
@@ -1,37 +0,0 @@
-\name{predictx}
-\alias{predictx}
-\title{Predict x from y values for calibration models}
-\description{
- This function predicts x values from y values, as in classical calibration,
- including a confindence interval.
-}
-\usage{
- predictx(m,yobs,level=0.95)
-}
-\arguments{
- \item{m}{
- A calibration model of type \code{\link{calm}}.
- }
- \item{yobs}{
- A vector of observed y values for one sample.
- }
- \item{level}{
- The confidence level for the confidence interval to be reported.
- }
-}
-\value{
- A vector containing the estimate (\code{estimate}), its estimated standard
- deviation (\code{sdxpred}), its estimated confidence (\code{confxpred}).
-}
-\examples{
- data(din32645)
- m <- calm(din32645)
- r <- predictx(m,3500,level=0.95)
- cat("\nThe confidence interval is",r[["estimate"]],"+-",r[["confxpred"]],"\n")
-}
-\author{
- Johannes Ranke
- \email{jranke@uni-bremen.de}
- \url{http://www.uft.uni-bremen.de/chemie/ranke}
-}
-\keyword{regression}

Contact - Imprint