aboutsummaryrefslogtreecommitdiff
path: root/inst/doc
diff options
context:
space:
mode:
authorranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4>2007-03-22 16:44:33 +0000
committerranke <ranke@5fad18fb-23f0-0310-ab10-e59a3bee62b4>2007-03-22 16:44:33 +0000
commit49679639ded05e7ef954c23f50d3d94d3d6dc1dd (patch)
treeb6dc323d45f296f9a296fb5586873a7818344be1 /inst/doc
parentf4443942f10740ecc62b928181a1911ef14eeb04 (diff)
Start of the integration of nonlinear calibration models
git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/chemCal@19 5fad18fb-23f0-0310-ab10-e59a3bee62b4
Diffstat (limited to 'inst/doc')
-rw-r--r--inst/doc/chemCal.Rnw36
1 files changed, 34 insertions, 2 deletions
diff --git a/inst/doc/chemCal.Rnw b/inst/doc/chemCal.Rnw
index 8cdc97c..956c664 100644
--- a/inst/doc/chemCal.Rnw
+++ b/inst/doc/chemCal.Rnw
@@ -29,8 +29,8 @@ on this subject. However, I did not encounter any proof or explanation of the
formula cited below yet, so I can't really confirm that Massart's method is correct.
When calibrating an analytical method, the first task is to generate a suitable
-model. If we want to use the \texttt{chemCal} functions, we will have to restrict
-ourselves to univariate, possibly weighted, linear regression so far.
+model. If we want to use the \texttt{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:
@@ -119,6 +119,38 @@ where I interpret $\frac{{s_s}^2}{w_s}$ as an estimator of the variance at locat
$\hat{x_s}$, which can be replaced by a user-specified value using the argument
\texttt{var.s} of the function \texttt{inverse.predict}.
+\section*{Fitting and using a variance function}
+
+In the R package \texttt{nlme} variance functions are used for weighted
+regressions. But since the \texttt{predict.nlme} method does not calculate
+prediction intervals, this is not useful for the \texttt{calplot} function.
+
+Two approaches could be used for fitting variance functions, one based on
+residuals from an unweighted fit, and one based on just the variances
+of the different samples along the x axis. If we used the residuals for
+fitting, a bias of the model in a certain area would result in a higher
+variance, so it seems preferable to choose the second approach. Of course,
+a prerequisite is to have sufficient repetitions for each sample in any
+case.
+
+Let's take the above example and estimate a variance function
+
+<<>>=
+massart97ex3
+massart97ex3$x <- factor(massart97ex3$x)
+summary <- summaryBy(y~x, data = massart97ex3,FUN=c(mean,sd,var))
+summary$x <- as.numeric(as.vector((summary$x)))
+plot(summary$x, summary$y.var,
+ xlim=c(0,50),
+ ylim=c(0,max(summary$y.var)))
+varModel <- lm(y.var ~ I(x^2) + x, data=summary)
+varCurve <- predict(varModel, newdata=data.frame(x=0:5000/100))
+lines(0:5000/100,varCurve)
+
+
+
+
+
\begin{thebibliography}{1}
\bibitem{massart97}
Massart, L.M, Vandenginste, B.G.M., Buydens, L.M.C., De Jong, S., Lewi, P.J.,

Contact - Imprint