if (FALSE) {
hspider[, 1:6] <- scale(hspider[, 1:6]) # Stdzed environmental vars
set.seed(123)
pcao1 <- cao(cbind(Pardlugu, Pardmont, Pardnigr, Pardpull, Zoraspin) ~
WaterCon + BareSand + FallTwig + CoveMoss + CoveHerb + ReflLux,
family = poissonff, data = hspider, Rank = 1, Bestof = 3,
df1.nl = c(Zoraspin = 2, 1.9), Crow1positive = TRUE)
siteNos <- 1:2 # Calibrate these sites
cpcao1 <- calibrate(pcao1, trace = TRUE,
newdata = data.frame(depvar(pcao1)[siteNos, ],
model.matrix(pcao1)[siteNos, ]))
# Graphically compare the actual site scores with their calibrated values
persp(pcao1, main = "Site scores: solid=actual, dashed=calibrated",
label = TRUE, col = "blue", las = 1)
abline(v = latvar(pcao1)[siteNos], col = seq(siteNos)) # Actual scores
abline(v = cpcao1, lty = 2, col = seq(siteNos)) # Calibrated values
}
Run the code above in your browser using DataLab