# NOT RUN {
hspider[, 1:6] <- scale(hspider[, 1:6]) # Stdze environmental variables
set.seed(123)
siteNos <- c(1, 5) # Calibrate these sites
pet1 <- cqo(cbind(Pardlugu, Pardmont, Pardnigr, Pardpull, Zoraspin) ~
WaterCon + BareSand + FallTwig + CoveMoss + CoveHerb + ReflLux,
data = hspider[-siteNos, ], # Sites not in fitted model
family = poissonff, I.toler = TRUE, Crow1positive = TRUE)
y0 <- hspider[siteNos, colnames(depvar(pet1))] # Species counts
cpet1 <- calibrate(pet1, trace = TRUE, newdata = data.frame(y0))
# }
# NOT RUN {
# }
# NOT RUN {
# Graphically compare the actual site scores with their calibrated values
persp(pet1, main = "Site scores: solid=actual, dashed=calibrated",
label = TRUE, col = "blue", las = 1)
# Actual site scores:
xvars <- rownames(concoef(pet1)) # Variables comprising the latvar
est.latvar <- as.matrix(hspider[siteNos, xvars]) <!-- %*% concoef(pet1) -->
abline(v = est.latvar, lty = 1, col = 1:length(siteNos))
abline(v = cpet1, lty = 2, col = 1:length(siteNos)) # Calibrated values
# }
Run the code above in your browser using DataLab