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.calibrate(object, ...)
...
is
newdata
which, for calibrate
, contains new
response data, Y, say.calibrate
methods functions to see
what they return.predict
(which takes an X and returns a Y.)predict
,
calibrate.qrrvglm
.hspider[,1:6] <- scale(hspider[,1:6]) # Standardized 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, new = data.frame(depvar(p1)[siteNos, ]), trace = TRUE)
# 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