diff options
-rw-r--r-- | DESCRIPTION | 12 | ||||
-rw-r--r-- | INDEX | 10 | ||||
-rw-r--r-- | R/chemCal.R | 195 | ||||
-rwxr-xr-x | chm/00Index.html | 26 | ||||
-rwxr-xr-x | chm/Rchm.css | 25 | ||||
-rwxr-xr-x | chm/calplot.html | 94 | ||||
-rwxr-xr-x | chm/calpredict.html | 106 | ||||
-rwxr-xr-x | chm/chemCal.chm | bin | 0 -> 25115 bytes | |||
-rwxr-xr-x | chm/chemCal.hhp | 17 | ||||
-rwxr-xr-x | chm/chemCal.toc | 51 | ||||
-rwxr-xr-x | chm/din32645.html | 44 | ||||
-rwxr-xr-x | chm/logo.jpg | bin | 0 -> 8793 bytes | |||
-rwxr-xr-x | chm/pahCalibration.html | 48 | ||||
-rw-r--r-- | data/din32645.rda | bin | 0 -> 453 bytes | |||
-rw-r--r-- | data/pahCalibration.rda | bin | 0 -> 1289 bytes | |||
-rw-r--r-- | data/pahMeasurements.rda | bin | 0 -> 1348 bytes | |||
-rw-r--r-- | man/calplot.Rd | 52 | ||||
-rw-r--r-- | man/calpredict.Rd | 64 | ||||
-rw-r--r-- | man/din32645.Rd | 15 | ||||
-rw-r--r-- | man/multical.Rd | 37 | ||||
-rw-r--r-- | man/pahCalibration.Rd | 19 | ||||
-rw-r--r-- | man/pahMeasurements.Rd | 19 |
22 files changed, 834 insertions, 0 deletions
diff --git a/DESCRIPTION b/DESCRIPTION new file mode 100644 index 0000000..18bcf09 --- /dev/null +++ b/DESCRIPTION @@ -0,0 +1,12 @@ +Package: chemCal +Version: 0.03-1 +Date: 2005-01-14 +Title: Calibration 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. +License: GPL version 2 or newer +URL: http://www.r-project.org, + http://www.uft.uni-bremen.de/chemie/ranke @@ -0,0 +1,10 @@ +calm Generate a linear calibration model +calplot Plot calibration graphs +plot.calm Plot prediction bands +calpredict Estimate measurement results including + confidence intervals +predict.calm Estimate measurement results including confidence + intervals +din32645 Calibration data from DIN 32645 +pahCalibration Calibration data for HPLC measurement of 4 PAH +pahMeasurements Measurement data for HPLC measurement of 4 PAH diff --git a/R/chemCal.R b/R/chemCal.R new file mode 100644 index 0000000..5de33f8 --- /dev/null +++ b/R/chemCal.R @@ -0,0 +1,195 @@ +calm <- function(data) +{ + y <- data[[2]] + x <- data[[1]] + m <- lm(y ~ x) + s <- summary(m) + if (s$coefficients[1,4] > 0.05) + { + m <- lm(y ~ x - 1) + s <- summary(m) + m$intercept <- FALSE + } else { + m$intercept <- TRUE + } + class(m) <- "calm" + m$yname <- names(data)[[1]] + m$xname <- names(data)[[2]] + return(m) +} +predict.calm <- predict.lm +print.calm <- print.lm +summary.calm <- summary.lm +plot.calm <- function(m, + xunit="",yunit="",measurand="", + level=0.95) +{ + x <- m$model$x + y <- m$model$y + newdata <- data.frame(x = seq(0,max(x),length=250)) + pred.lim <- predict(m, newdata, interval = "prediction",level=level) + conf.lim <- predict(m, newdata, interval = "confidence",level=level) + if (xunit!="") { + xlab <- paste("Concentration in ",xunit) + } else xlab <- m$xname + if (yunit=="") yunit <- m$yname + if (measurand!="") { + main <- paste("Calibration for",measurand) + } else main <- "Calibration" + plot(1, + xlab = xlab, + ylab = yunit, + type = "n", + main = main, + xlim = c(0,max(x)), + ylim = range(pred.lim) + ) + points(x,y, pch = 21, bg = "yellow") + matlines(newdata$x, pred.lim, lty = c(1, 4, 4), + col = c("black", "red", "red")) + matlines(newdata$x, 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", + "Prediction Bands"), + lty = c(1, 3, 4), + lwd = 2, + col = c("black", "green4", "red"), + horiz = FALSE, cex = 0.9, bg = "gray95") +} +predictx.calm <- function(m,measurements) +{ + s <- summary(m) + xi <- m$model$x + yi <- m$model$y + n <- length(yi) + yobs <- newdata[[1]] + p <- length(yobs) + if (!m$intercept) + { + varb1 <- summary(m)$coef["x","Std. Error"]^2 + xpred <- mean(yobs)/b1 + varxpred <- (varyobs + xpred^2 * varb1) / b1^2 + sdxpred <- sqrt(varxpred) + } else + { + b0 <- summary(m)$coef["(Intercept)","Estimate"] + b1 <- summary(m)$coef["xi","Estimate"] + xpred <- (mean(yobs) - b0)/b1 + sumxxbar <- sum((xi - mean(xi))^2) + if (!syobs) + { + yybar <- (mean(yobs) - mean(yi))^2 + sdxpred <- (S/b1) * (1/p + 1/n + yybar/(b1^2 * sumxxbar))^0.5 + } else + { + sdxpred <- ((varyobs^0.5/b1) + (S/b1)^2 * (1/n + ((xpred - mean(xi))^2)/sumxxbar))^0.5 + } + } + t <- qt((1 + level)/2,ntot - 2) + confxpred <- t * sdxpred + + result <- c(estimate=xpred,sdxpred=sdxpred,syobs=syobs, + confxpred=confxpred) + digits <- max(c(3,round(log10(xpred/confxpred)) + 2)) + roundedresult <- round(result,digits=digits) + confidenceinterval <- paste(roundedresult["estimate"],"+-", + roundedresult["confxpred"],xunit) + roundedresult[["confidenceinterval"]] <- confidenceinterval + invisible(roundedresult) +} +calpredict <- function(yobs,xi,yi,xunit="",level=0.95,intercept=FALSE,syobs=FALSE) +{ + if (length(xi)!=length(yi)) + { + cat("xi and yi have to be of the same length\n") + } + xi <- xi[!is.na(yi)] + yi <- yi[!is.na(yi)] + n <- length(yi) + p <- length(yobs) + if (!intercept) + { + m <- lm(yi ~ xi - 1) + } else + { + m <- lm(yi ~ xi) + } + S <- summary(m)$sigma + b1 <- summary(m)$coef["xi","Estimate"] + + if (syobs) + { + if (is.numeric(syobs)) + { + varyobs <- syobs^2 + ntot <- n + } else + { + if (length(yobs)==1) + { + cat("yobs has to contain more than one number vector, if you use syobs=TRUE\n") + } + varyobs <- var(yobs) + ntot <- n + p + } + } else + { + varyobs <- S^2 + ntot <- n + } + + if (!intercept) + { + varb1 <- summary(m)$coef["xi","Std. Error"]^2 + xpred <- mean(yobs)/b1 + varxpred <- (varyobs + xpred^2 * varb1) / b1^2 + sdxpred <- sqrt(varxpred) + } else + { + b0 <- summary(m)$coef["(Intercept)","Estimate"] + b1 <- summary(m)$coef["xi","Estimate"] + xpred <- (mean(yobs) - b0)/b1 + sumxxbar <- sum((xi - mean(xi))^2) + if (!syobs) + { + yybar <- (mean(yobs) - mean(yi))^2 + sdxpred <- (S/b1) * (1/p + 1/n + yybar/(b1^2 * sumxxbar))^0.5 + } else + { + sdxpred <- ((varyobs^0.5/b1) + (S/b1)^2 * (1/n + ((xpred - mean(xi))^2)/sumxxbar))^0.5 + } + } + t <- qt((1 + level)/2,ntot - 2) + confxpred <- t * sdxpred + + result <- c(estimate=xpred,sdxpred=sdxpred,syobs=syobs, + confxpred=confxpred) + digits <- max(c(3,round(log10(xpred/confxpred)) + 2)) + roundedresult <- round(result,digits=digits) + confidenceinterval <- paste(roundedresult["estimate"],"+-", + roundedresult["confxpred"],xunit) + roundedresult[["confidenceinterval"]] <- confidenceinterval + invisible(roundedresult) +} + +multical <- function(cf,df,intercept=FALSE) +{ + rf <- data.frame(name=levels(df$name)) + substances <- colnames(df)[-1] + for (s in substances) + { + r <- vector() + for (sample in levels(df$name)) + { + tmp <- calpredict(subset(df,name==sample)[[s]], + cf[["conc"]],cf[[s]], + intercept=intercept) + r <- c(r,tmp[["confidenceinterval"]]) + } + rf[[s]] <- r + } + return(rf) +} diff --git a/chm/00Index.html b/chm/00Index.html new file mode 100755 index 0000000..89e77ff --- /dev/null +++ b/chm/00Index.html @@ -0,0 +1,26 @@ +<html><head><title>Calibration for analytical chemistry</title>
+<link rel="stylesheet" type="text/css" href="Rchm.css">
+</head><body>
+<h1>Calibration for analytical chemistry
+<img class="toplogo" src="logo.jpg" alt="[R logo]"></h1>
+
+<hr>
+
+<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
+<param name="keyword" value=".. contents">
+</object>
+
+<h2>Help pages for package `chemCal' version 0.01-2</h2>
+
+
+<table width="100%">
+<tr><td width="25%"><a href="calplot.html">calplot</a></td>
+<td>Plot calibration graphs</td></tr>
+<tr><td width="25%"><a href="calpredict.html">calpredict</a></td>
+<td>Estimate measurement results including confidence intervals</td></tr>
+<tr><td width="25%"><a href="din32645.html">din32645</a></td>
+<td>Calibration data from DIN 32645</td></tr>
+<tr><td width="25%"><a href="pahCalibration.html">pahCalibration</a></td>
+<td>Calibration data for HPLC measurement of 4 PAH</td></tr>
+</table>
+</body></html>
diff --git a/chm/Rchm.css b/chm/Rchm.css new file mode 100755 index 0000000..badd579 --- /dev/null +++ b/chm/Rchm.css @@ -0,0 +1,25 @@ +BODY{ background: white; + color: black } + +A:link{ background: white; + color: blue } +A:visited{ background: white; + color: rgb(50%, 0%, 50%) } + +H1{ background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: large; + text-align: center } + +H2{ background: white; + color: rgb(0%, 0%, 100%); + font-family: monospace; + text-align: center } + +H3{ background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace } + +IMG.toplogo{ vertical-align: middle } + diff --git a/chm/calplot.html b/chm/calplot.html new file mode 100755 index 0000000..a2b8158 --- /dev/null +++ b/chm/calplot.html @@ -0,0 +1,94 @@ +<html><head><title>Plot calibration graphs</title>
+<link rel="stylesheet" type="text/css" href="Rchm.css">
+</head>
+<body>
+
+<table width="100%"><tr><td>calplot(chemCal)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
+<param name="keyword" value="R: calplot">
+<param name="keyword" value=" Plot calibration graphs">
+</object>
+
+
+<h2>Plot calibration graphs</h2>
+
+
+<h3>Description</h3>
+
+<p>
+Produce graphics of calibration data, the fitted model as well
+as prediction and confidence intervals.
+</p>
+
+
+<h3>Usage</h3>
+
+<pre>
+ calplot(x,y,intercept=FALSE,measurand="substance x",xunit="mg/L",yunit="Area",level=0.95)
+</pre>
+
+
+<h3>Arguments</h3>
+
+<table summary="R argblock">
+<tr valign="top"><td><code>x</code></td>
+<td>
+A vector of x values.
+</td></tr>
+<tr valign="top"><td><code>y</code></td>
+<td>
+A vector of y values.
+</td></tr>
+<tr valign="top"><td><code>intercept</code></td>
+<td>
+A boolean describing if the calibration curve is to be forced
+through zero.
+</td></tr>
+<tr valign="top"><td><code>measurand</code></td>
+<td>
+The name of what is being measured as a character vector.
+</td></tr>
+<tr valign="top"><td><code>xunit</code></td>
+<td>
+The unit of the given values on the x axis as a character vector.
+</td></tr>
+<tr valign="top"><td><code>yunit</code></td>
+<td>
+The unit of the y axis as a character vector. Defaults to "Area".
+</td></tr>
+<tr valign="top"><td><code>level</code></td>
+<td>
+The confidence level of the confidence and prediction bands. Defaults to
+0.95.
+</td></tr>
+</table>
+
+<h3>Value</h3>
+
+<p>
+A linear model object for y ~ x. You will also get a plot of the calibration
+data, of your fitted model as well as lines showing the confidence limits and
+the prediction limits.</p>
+
+<h3>Author(s)</h3>
+
+<p>
+Johannes Ranke
+<a href="mailto:jranke@uni-bremen.de">jranke@uni-bremen.de</a>
+<a href="http://www.uft.uni-bremen.de/chemie/ranke">http://www.uft.uni-bremen.de/chemie/ranke</a>
+</p>
+
+
+<h3>Examples</h3>
+
+<pre>
+data(pahCalibration)
+attach(pahCalibration)
+## Not run: calplot(conc,phenanthrene,"Phenanthrene","mg/L")
+detach(pahCalibration)
+</pre>
+
+
+
+<hr><div align="center"><a href="00Index.html">[Package Contents]</a></div>
+
+</body></html>
diff --git a/chm/calpredict.html b/chm/calpredict.html new file mode 100755 index 0000000..dff8ec4 --- /dev/null +++ b/chm/calpredict.html @@ -0,0 +1,106 @@ +<html><head><title>Estimate measurement results including confidence intervals</title>
+<link rel="stylesheet" type="text/css" href="Rchm.css">
+</head>
+<body>
+
+<table width="100%"><tr><td>calpredict(chemCal)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
+<param name="keyword" value="R: calpredict">
+<param name="keyword" value=" Estimate measurement results including confidence intervals">
+</object>
+
+
+<h2>Estimate measurement results including confidence intervals</h2>
+
+
+<h3>Description</h3>
+
+<p>
+This function generates estimates for x values from y values, including
+a confidence interval for the x values. The formulas in this function used
+for prediction of concentrations from (replicate) measurements are taken from
+the "Handbook of Chemometrics and Qualimetrics Part A" by D. L. Massart,
+Vandeginste, B. G. M., Buydens, L. M. C., De Jong, S., Lewi, P. J. and
+Smeyers-Verbeke, J, Elsevier, Amsterdam, 1997 and from the EURACHEM/CITAC
+report on "Quantifying uncertainty in analytical measurement", 2000,
+pp. 111f.
+</p>
+
+
+<h3>Usage</h3>
+
+<pre>
+ calpredict(yobs,xi,yi,xunit="",level=0.95,intercept=FALSE,syobs=FALSE)
+</pre>
+
+
+<h3>Arguments</h3>
+
+<table summary="R argblock">
+<tr valign="top"><td><code>yobs</code></td>
+<td>
+A numeric vector containing the observed data.
+</td></tr>
+<tr valign="top"><td><code>xi</code></td>
+<td>
+A vector of x values of the calibration.
+</td></tr>
+<tr valign="top"><td><code>yi</code></td>
+<td>
+A vector of y values of the calibration.
+</td></tr>
+<tr valign="top"><td><code>xunit</code></td>
+<td>
+The unit of the given values on the x axis as a character string.
+</td></tr>
+<tr valign="top"><td><code>level</code></td>
+<td>
+The desired confidence level for the confidence interval of the
+estimates. Defaults to 0.95.
+</td></tr>
+<tr valign="top"><td><code>intercept</code></td>
+<td>
+Logical value determining if an intercept is to be fitted or not.
+Default is FALSE.
+</td></tr>
+<tr valign="top"><td><code>syobs</code></td>
+<td>
+If TRUE, a standard deviation for the given y values is
+calculated, and the resulting confidence interval will
+include this variability (not validated yet). If FALSE (default), this
+standard deviation is not included in the
+confidence interval. If a numeric value is given,
+it is used for the standard deviation of "real samples",
+in addition to the standard deviation of the y values
+in the calibration (also not validated yet).
+</td></tr>
+</table>
+
+<h3>Value</h3>
+
+<p>
+A list containing the estimate, its standard deviation and its
+confidence interval.</p>
+
+<h3>Author(s)</h3>
+
+<p>
+Johannes Ranke
+<a href="mailto:jranke@uni-bremen.de">jranke@uni-bremen.de</a>
+<a href="http://www.uft.uni-bremen.de/chemie/ranke">http://www.uft.uni-bremen.de/chemie/ranke</a>
+</p>
+
+
+<h3>Examples</h3>
+
+<pre>
+data(pahCalibration)
+attach(pahCalibration)
+y <- c(51.2,51.4,51.1,51.8)
+estimate <- calpredict(y,conc,acenaphthene,xunit="mg/L")
+</pre>
+
+
+
+<hr><div align="center"><a href="00Index.html">[Package Contents]</a></div>
+
+</body></html>
diff --git a/chm/chemCal.chm b/chm/chemCal.chm Binary files differnew file mode 100755 index 0000000..df88b92 --- /dev/null +++ b/chm/chemCal.chm diff --git a/chm/chemCal.hhp b/chm/chemCal.hhp new file mode 100755 index 0000000..3b1318b --- /dev/null +++ b/chm/chemCal.hhp @@ -0,0 +1,17 @@ +[OPTIONS]
+Auto Index=Yes
+Contents file=chemCal.toc
+Compatibility=1.1 or later
+Compiled file=chemCal.chm
+Default topic=00Index.html
+Display compile progress=No
+Full-text search=Yes
+Full text search stop list file=..\..\..\gnuwin32\help\R.stp
+
+
+[FILES]
+00Index.html
+calplot.html
+calpredict.html
+din32645.html
+pahCalibration.html
diff --git a/chm/chemCal.toc b/chm/chemCal.toc new file mode 100755 index 0000000..ab7c2f1 --- /dev/null +++ b/chm/chemCal.toc @@ -0,0 +1,51 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<HEAD></HEAD><HTML><BODY>
+<UL>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="Package chemCal: Contents">
+<param name="Local" value="00Index.html">
+</OBJECT>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="Package chemCal: R objects">
+</OBJECT>
+<UL>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="calplot">
+<param name="Local" value="calplot.html">
+</OBJECT>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="calpredict">
+<param name="Local" value="calpredict.html">
+</OBJECT>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="din32645">
+<param name="Local" value="din32645.html">
+</OBJECT>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="pahCalibration">
+<param name="Local" value="pahCalibration.html">
+</OBJECT>
+</UL>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="Package chemCal: Titles">
+</OBJECT>
+<UL>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="Calibration data for HPLC measurement of 4 PAH">
+<param name="Local" value="pahCalibration.html">
+</OBJECT>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="Calibration data from DIN 32645">
+<param name="Local" value="din32645.html">
+</OBJECT>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="Estimate measurement results including confidence intervals">
+<param name="Local" value="calpredict.html">
+</OBJECT>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="Plot calibration graphs">
+<param name="Local" value="calplot.html">
+</OBJECT>
+</UL>
+</UL>
+</BODY></HTML>
diff --git a/chm/din32645.html b/chm/din32645.html new file mode 100755 index 0000000..f0550f7 --- /dev/null +++ b/chm/din32645.html @@ -0,0 +1,44 @@ +<html><head><title>Calibration data from DIN 32645</title>
+<link rel="stylesheet" type="text/css" href="Rchm.css">
+</head>
+<body>
+
+<table width="100%"><tr><td>din32645(chemCal)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
+<param name="keyword" value="R: din32645">
+<param name="keyword" value=" Calibration data from DIN 32645">
+</object>
+
+
+<h2>Calibration data from DIN 32645</h2>
+
+
+<h3>Description</h3>
+
+<p>
+Sample dataset to test the package.
+</p>
+
+
+<h3>Usage</h3>
+
+<pre>data(pahCalibration)</pre>
+
+
+<h3>Format</h3>
+
+<p>
+A dataframe containing 10 rows of x and y values.
+</p>
+
+
+<h3>Source</h3>
+
+<p>
+<a href="http://www.uft.uni-bremen.de/chemie">http://www.uft.uni-bremen.de/chemie</a>
+</p>
+
+
+
+<hr><div align="center"><a href="00Index.html">[Package Contents]</a></div>
+
+</body></html>
diff --git a/chm/logo.jpg b/chm/logo.jpg Binary files differnew file mode 100755 index 0000000..b8e2149 --- /dev/null +++ b/chm/logo.jpg diff --git a/chm/pahCalibration.html b/chm/pahCalibration.html new file mode 100755 index 0000000..10d1774 --- /dev/null +++ b/chm/pahCalibration.html @@ -0,0 +1,48 @@ +<html><head><title>Calibration data for HPLC measurement of 4 PAH</title>
+<link rel="stylesheet" type="text/css" href="Rchm.css">
+</head>
+<body>
+
+<table width="100%"><tr><td>pahCalibration(chemCal)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
+<param name="keyword" value="R: pahCalibration">
+<param name="keyword" value=" Calibration data for HPLC measurement of 4 PAH">
+</object>
+
+
+<h2>Calibration data for HPLC measurement of 4 PAH</h2>
+
+
+<h3>Description</h3>
+
+<p>
+This dataset was produced during a course on trace analysis
+of organic contaminants. The data are far from perfect, but
+good enough to serve as an example.
+</p>
+
+
+<h3>Usage</h3>
+
+<pre>data(pahCalibration)</pre>
+
+
+<h3>Format</h3>
+
+<p>
+A dataframe containing the areas for the four polycyclic aromatic
+hydrocarbons (PAH) Acenaphthene, Phenanthrene, Anthracene and Pyrene.
+Each measurement of a standard solution makes up one row.
+</p>
+
+
+<h3>Source</h3>
+
+<p>
+<a href="http://www.uft.uni-bremen.de/chemie">http://www.uft.uni-bremen.de/chemie</a>
+</p>
+
+
+
+<hr><div align="center"><a href="00Index.html">[Package Contents]</a></div>
+
+</body></html>
diff --git a/data/din32645.rda b/data/din32645.rda Binary files differnew file mode 100644 index 0000000..4e2913a --- /dev/null +++ b/data/din32645.rda diff --git a/data/pahCalibration.rda b/data/pahCalibration.rda Binary files differnew file mode 100644 index 0000000..a0ae738 --- /dev/null +++ b/data/pahCalibration.rda diff --git a/data/pahMeasurements.rda b/data/pahMeasurements.rda Binary files differnew file mode 100644 index 0000000..657e552 --- /dev/null +++ b/data/pahMeasurements.rda diff --git a/man/calplot.Rd b/man/calplot.Rd new file mode 100644 index 0000000..7500912 --- /dev/null +++ b/man/calplot.Rd @@ -0,0 +1,52 @@ +\name{calplot} +\alias{calplot} +\title{Plot calibration graphs} +\description{ + Produce graphics of calibration data, the fitted model as well + as prediction and confidence intervals. +} +\usage{ + calplot(x,y,intercept=FALSE,measurand="substance x",xunit="mg/L",yunit="Area",level=0.95) +} +\arguments{ + \item{x}{ + A vector of x values. + } + \item{y}{ + A vector of y values. + } + \item{intercept}{ + A boolean describing if the calibration curve is to be forced + through zero. + } + \item{measurand}{ + The name of what is being measured as a character vector. + } + \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. Defaults to "Area". + } + \item{level}{ + The confidence level of the confidence and prediction bands. Defaults to + 0.95. + } +} +\value{ + A linear model object for y ~ x. You will also get a plot of the calibration + data, of your fitted model as well as lines showing the confidence limits and + the prediction limits. +} +\examples{ +data(pahCalibration) +attach(pahCalibration) +\dontrun{calplot(conc,phenanthrene,"Phenanthrene","mg/L")} +detach(pahCalibration) +} +\author{ + Johannes Ranke + \email{jranke@uni-bremen.de} + \url{http://www.uft.uni-bremen.de/chemie/ranke} +} +\keyword{regression} diff --git a/man/calpredict.Rd b/man/calpredict.Rd new file mode 100644 index 0000000..a91d018 --- /dev/null +++ b/man/calpredict.Rd @@ -0,0 +1,64 @@ +\name{calpredict} +\alias{calpredict} +\title{Estimate measurement results including confidence intervals} +\description{ + This function generates estimates for x values from y values, including + a confidence interval for the x values. The formulas in this function used + for prediction of concentrations from (replicate) measurements are taken from + the "Handbook of Chemometrics and Qualimetrics Part A" by D. L. Massart, + Vandeginste, B. G. M., Buydens, L. M. C., De Jong, S., Lewi, P. J. and + Smeyers-Verbeke, J, Elsevier, Amsterdam, 1997 and from the EURACHEM/CITAC + report on "Quantifying uncertainty in analytical measurement", 2000, + pp. 111f. +} +\usage{ + calpredict(yobs,xi,yi,xunit="",level=0.95,intercept=FALSE,syobs=FALSE) +} +\arguments{ + \item{yobs}{ + A numeric vector containing the observed data. + } + \item{xi}{ + A vector of x values of the calibration. + } + \item{yi}{ + A vector of y values of the calibration. + } + \item{xunit}{ + The unit of the given values on the x axis as a character string. + } + \item{level}{ + The desired confidence level for the confidence interval of the + estimates. Defaults to 0.95. + } + \item{intercept}{ + Logical value determining if an intercept is to be fitted or not. + Default is FALSE. + } + \item{syobs}{ + If TRUE, a standard deviation for the given y values is + calculated, and the resulting confidence interval will + include this variability (not validated yet). If FALSE (default), this + standard deviation is not included in the + confidence interval. If a numeric value is given, + it is used for the standard deviation of "real samples", + in addition to the standard deviation of the y values + in the calibration (also not validated yet). + } +} +\value{ + A list containing the estimate, its standard deviation and its + confidence interval. +} +\examples{ +data(pahCalibration) +attach(pahCalibration) +y <- c(51.2,51.4,51.1,51.8) +estimate <- calpredict(y,conc,acenaphthene,xunit="mg/L") +} +\author{ + Johannes Ranke + \email{jranke@uni-bremen.de} + \url{http://www.uft.uni-bremen.de/chemie/ranke} +} +\keyword{regression} diff --git a/man/din32645.Rd b/man/din32645.Rd new file mode 100644 index 0000000..901bdf0 --- /dev/null +++ b/man/din32645.Rd @@ -0,0 +1,15 @@ +\name{din32645} +\docType{data} +\alias{din32645} +\title{Calibration data from DIN 32645} +\description{ + Sample dataset to test the package. +} +\usage{data(pahCalibration)} +\format{ + A dataframe containing 10 rows of x and y values. +} +\source{ + \url{http://www.uft.uni-bremen.de/chemie} +} +\keyword{datasets} diff --git a/man/multical.Rd b/man/multical.Rd new file mode 100644 index 0000000..7d62277 --- /dev/null +++ b/man/multical.Rd @@ -0,0 +1,37 @@ +\name{multical} +\alias{multical} +\title{Calculation of results in a dataframe} +\description{ + This function provides the possibility to perform the calibration + of multiple components simultaneously, and to provide the results + including confidence intervals in a dataframe. +} +\usage{ + multical(cf,df,intercept=FALSE) +} +\arguments{ + \item{cf}{ + A data frame containig the data for the calibration standards. + } + \item{df}{ + A data frame with the measured sample data. + } + \item{intercept}{ + Logical value determining if an intercept is to be fitted or not. + Default is FALSE. + } +} +\value{ + A data frame containig the measurement results with a confidence interval. +} +\examples{ +data(pahCalibration) +data(pahMeasurements) +result <- multical(pahCalibration,pahMeasurements) +} +\author{ + Johannes Ranke + \email{jranke@uni-bremen.de} + \url{http://www.uft.uni-bremen.de/chemie/ranke} +} +\keyword{regression} diff --git a/man/pahCalibration.Rd b/man/pahCalibration.Rd new file mode 100644 index 0000000..540af4a --- /dev/null +++ b/man/pahCalibration.Rd @@ -0,0 +1,19 @@ +\name{pahCalibration} +\docType{data} +\alias{pahCalibration} +\title{Calibration data for HPLC measurement of 4 PAH} +\description{ + This dataset was produced during a course on trace analysis + of organic contaminants. The data are far from perfect, but + good enough to serve as an example. +} +\usage{data(pahCalibration)} +\format{ + A dataframe containing the areas for the four polycyclic aromatic + hydrocarbons (PAH) Acenaphthene, Phenanthrene, Anthracene and Pyrene. + Each measurement of a standard solution makes up one row. +} +\source{ + \url{http://www.uft.uni-bremen.de/chemie} +} +\keyword{datasets} diff --git a/man/pahMeasurements.Rd b/man/pahMeasurements.Rd new file mode 100644 index 0000000..77b646b --- /dev/null +++ b/man/pahMeasurements.Rd @@ -0,0 +1,19 @@ +\name{pahMeasurements} +\docType{data} +\alias{pahMeasurements} +\title{Measurement data for HPLC measurement of 4 PAH} +\description{ + This dataset was produced during a course on trace analysis + of organic contaminants. The data are far from perfect, but + good enough to serve as an example. +} +\usage{data(pahMeasurements)} +\format{ + A dataframe containing the areas for the four polycyclic aromatic + hydrocarbons (PAH) Acenaphthene, Phenanthrene, Anthracene and Pyrene + in the different samples. +} +\source{ + \url{http://www.uft.uni-bremen.de/chemie} +} +\keyword{datasets} |