
Last chance! 50% off unlimited learning
Sale ends in
calibrate(formula, data, test.higher.orders = TRUE, max.order = 4, p.crit = 0.05,
F.test = "partial", weights, subset, na.action, method = "qr", model = FALSE,
x = FALSE, y = FALSE, contrasts = NULL, warn = TRUE, ...)
formula
object, with the response on the left of a ~
operator, and
the single predictor variable on the right. For example, Cadmium ~ Spike
.as.data.frame
to a data frame) containing the variables in
the model. If not found in data
, the variables are taktest.higher.orders=TRUE
; the default), or to simply max.order=4
, however, the final value of
max.order
is the minimum of max.order
and value of p.crit=0.05
.F.test="partial"
; the default) or using the
lack-of-fit F-test (F.test="lof"
).NAs
.
The default is set by the na.action
setting of options
, and is
method = "qr"
is supported;
method = "model.frame"
returns the model frame (the same as with
model = TRUE
, see below).TRUE
the corresponding components of the fit (the model frame,
the model matrix, the response, the QR decomposition) are returned.contrasts.arg
of model.matrix
.warn=TRUE
; the default) when
the value of max.order
has been decreased from what the user supplied.
See also the explanation above for the argument max.order
lm
).calibrate
initially fits a linear calibration model. If the argument
max.order
is greater than 1, calibrate
then performs forward stepwise linear
regression to determine the calibrate
uses standard stepwise
ANOVA to compare models (Draper and Smith, 1998, p.335). In this case, if the p-value
for the partial F-test to compare models is greater than or equal to p.crit
, then
the model with fewer terms is used as the final model.
In the case where replicates are available, if F.test="lof"
, then for each model
calibrate
computes the p-value of the ANOVA for lack-of-fit vs. pure error
(Draper and Smith, 1998, Chapters 2; see anovaPE
). If the p-value is
greater than or equal to p.crit
, then this is the final model; otherwise the next
higher-order term is added to the polynomial and the model is re-fit. If, during the
stepwise procedure, the degrees of freedom associated with the residual sums of squares
of a model to be tested is less than or equal to the number of observations minus the
number of unique observations, calibrate
uses the partial F-test instead of the
lack-of-fit F-test.
The stepwise algorithm terminates when either the p-value is greater than or equal to
p.crit
, or the currently selected model in the algorithm is of order
max.order
. The algorithm will terminate earlier than this if the next model to be
fit includes singularities so that not all coefficients can be estimted.calibrate.object
, anovaPE
,
inversePredictCalibrate
,
detectionLimitCalibrate
, lm
.# The data frame EPA.97.cadmium.111.df contains calibration data for
# cadmium at mass 111 (ng/L) that appeared in Gibbons et al. (1997b)
# and were provided to them by the U.S. EPA.
# Display a plot of these data along with the fitted calibration line
# and 99\% non-simultaneous prediction limits. See
# Millard and Neerchal (2001, pp.566-569) for more details on this
# example.
Cadmium <- EPA.97.cadmium.111.df$Cadmium
Spike <- EPA.97.cadmium.111.df$Spike
calibrate.list <- calibrate(Cadmium ~ Spike, data = EPA.97.cadmium.111.df)
newdata <- data.frame(Spike = seq(min(Spike), max(Spike), len = 100))
pred.list <- predict(calibrate.list, newdata = newdata, se.fit = TRUE)
pointwise.list <- pointwise(pred.list, coverage = 0.99, individual = TRUE)
dev.new()
plot(Spike, Cadmium, ylim = c(min(pointwise.list$lower),
max(pointwise.list$upper)), xlab = "True Concentration (ng/L)",
ylab = "Observed Concentration (ng/L)")
abline(calibrate.list, lwd = 2)
lines(newdata$Spike, pointwise.list$lower, lty = 8, lwd = 2)
lines(newdata$Spike, pointwise.list$upper, lty = 8, lwd = 2)
title(paste("Calibration Line and 99% Prediction Limits",
"for US EPA Cadmium 111 Data", sep = ""))
#----------
# Clean up
#---------
rm(Cadmium, Spike, newdata, calibrate.list, pred.list, pointwise.list)
graphics.off()
Run the code above in your browser using DataLab