calibrate.qrrvglm {VGAM} | R Documentation |
Performs maximum likelihood calibration for constrained and unconstrained quadratic and additive ordination models (CQO and CAO models are better known as QRR-VGLMs and RR-VGAMs respectively).
calibrate.qrrvglm(object, newdata = NULL, type = c("latvar", "predictors", "response", "vcov", "all3or4"), se.type = c("asbefore", "wald"), initial.vals = NULL, ...)
object |
The fitted CQO/CAO model. |
newdata |
A data frame with new response data (usually new species data). The default is to use the original data used to fit the model; however, the calibration may take a long time to compute because the computations are expensive. |
type |
What type of result is to be returned.
The first are the calibrated latent variables or site scores.
This must be computed always.
The |
se.type |
What type of standard errors are to be returned.
The choice |
initial.vals |
Initial values for the search.
For rank-1 models, this should be a vector of length
|
... |
Arguments that are fed into
|
Given a fitted regression CQO/CAO model, maximum likelihood calibration is theoretically easy and elegant. However, the method assumes that all species are independent, which is not really true in practice. More details and references are given in Yee (2018) and ch.6 of Yee (2015).
The function optim
is used to search for
the maximum likelihood solution. Good initial values are
needed, and calibrate.qrrvglm.control
allows the user some control over the choice of these.
The argument type
determines what is returned.
If type = "all3or4"
then all the type
values
are returned in a list, with the following components.
Each component has length nrow(newdata)
.
latvar |
Calibrated latent variables or site scores. |
predictors |
linear/quadratic or additive predictors. For example, for Poisson families, this will be on a log scale, and for binomial families, this will be on a logit scale. |
response |
Fitted values of the response, evaluated at the calibrated latent variables or site scores. |
vcov |
Estimated variance-covariance matrix of the
calibrated latent variables or site scores. Actually,
these are stored in an array whose last dimension is
|
This function is computationally expensive.
Setting trace = TRUE
to get a running log is a good idea.
Despite the name of this function, CAO models are handled as well.
T. W. Yee. Recent work on the standard errors by David Zucker and Sam Oman at HUJI is gratefully acknowledged.
Yee, T. W. (2018) On constrained and unconstrained quadratic ordination. Manuscript in preparation.
ter Braak, C. J. F. 1995. Calibration. In: Data Analysis in Community and Landscape Ecology by Jongman, R. H. G., ter Braak, C. J. F. and van Tongeren, O. F. R. (Eds.) Cambridge University Press, Cambridge.
calibrate.qrrvglm.control
,
calibrate.rrvglm
,
calibrate
,
cqo
,
cao
.
## 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)) ## End(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]) abline(v = est.latvar, lty = 1, col = 1:length(siteNos)) abline(v = cpet1, lty = 2, col = 1:length(siteNos)) # Calibrated values ## End(Not run)