Learn R Programming

VGAM (version 1.0-5)

calibrate: Model Calibrations

Description

calibrate is a generic function used to produce calibrations from various model fitting functions. The function invokes particular `methods' which depend on the `class' of the first argument.

Usage

calibrate(object, ...)

Arguments

object

An object for which a calibration is desired.

Additional arguments affecting the calibration produced. Usually the most important argument in is newdata which, for calibrate, contains new response data, Y, say.

Value

In general, given a new response Y, the explanatory variables X are returned. However, for constrained ordination models such as CQO and CAO models, it is usually not possible to return X, so the latent variables are returned instead (they are linear combinations of the X). See the specific calibrate methods functions to see what they return.

Details

Given a regression model with explanatory variables X and response Y, calibration involves estimating X from Y using the regression model. It can be loosely thought of as the opposite of predict (which takes an X and returns a Y.)

See Also

predict, calibrate.rrvglm, calibrate.qrrvglm.

Examples

Run this code
# NOT RUN {
hspider[, 1:6] <- scale(hspider[, 1:6])  # Stdzed environmental vars
set.seed(123)
p1 <- cao(cbind(Pardlugu, Pardmont, Pardnigr, Pardpull, Zoraspin) ~
          WaterCon + BareSand + FallTwig +
          CoveMoss + CoveHerb + ReflLux,
          family = poissonff, data = hspider, Rank = 1,
          df1.nl = c(Zoraspin = 2, 1.9),
          Bestof = 3, Crow1positive = TRUE)

siteNos <- 1:2  # Calibrate these sites
cp1 <- calibrate(p1, trace = TRUE,
  new = data.frame(depvar(p1)[siteNos, ], model.matrix(p1)[siteNos, ]))

# Graphically compare the actual site scores with their calibrated values
persp(p1, main = "Solid=actual, dashed=calibrated site scores",
      label = TRUE, col = "blue", las = 1)
# Actual site scores:
abline(v = latvar(p1)[siteNos], lty = 1, col = 1:length(siteNos))
abline(v = cp1, lty = 2, col = 1:length(siteNos))  # Calibrated values
# }

Run the code above in your browser using DataLab