calibrate.qrrvglm {VGAM} | R Documentation

## Calibration for CQO and CAO models

### Description

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).

### Usage

    calibrate.qrrvglm(object, newdata = NULL,
            type = c("latvar", "predictors", "response", "vcov", "all3or4"),
            initial.vals = NULL, ...)

### Arguments

`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 `"predictors"` are the linear/quadratic or additive predictors evaluated at the calibrated latent variables or site scores. The `"response"` are the fitted means evaluated at the calibrated latent variables or site scores. The `"vcov"` are the estimated variance-covariance matrices of the calibrated latent variables or site scores. The `"all3or4"` is for all of them, i.e., all `type`s. For CAO models, `"vcov"` is unavailable, so all 3 are returned. For CQO models, `"vcov"` is available, so all 4 are returned.

`initial.vals` | Initial values for the search. For rank-1 models, this should be a vector of length `nrow(newdata)`, and for rank 2 models this should be a two column matrix with the number of rows equalling the number of rows in `newdata`. The default is a grid defined by arguments in `calibrate.qrrvglm.control`.
`...` | Arguments that are fed into `calibrate.qrrvglm.control`.

### Details

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 (2012).

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.

### Value

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 `nrow(newdata)`.

### Warning

This function is computationally expensive. Setting `trace = TRUE` to get a running log is a good idea.

### Note

Despite the name of this function, CAO models are handled as well.

### Author(s)

T. W. Yee

### References

Yee, T. W. (2017) 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.

### See Also

`calibrate.qrrvglm.control`, `calibrate.rrvglm`, `calibrate`, `cqo`, `cao`.

### Examples

    ## Not run:
    hspider[, 1:6] <- scale(hspider[, 1:6])  # Stdze the environmental variables
    set.seed(123)
    p1 <- cqo(cbind(Pardlugu, Pardmont, Pardnigr, Pardpull, Zoraspin) ~
              WaterCon + BareSand + FallTwig +
              CoveMoss + CoveHerb + ReflLux,
              family = poissonff, data = hspider, Rank = 1,
              I.toler = TRUE, Crow1positive = TRUE)

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

    ## End(Not run)

    ## Not run:
    # Graphically compare the actual site scores with their calibrated values
    persp(p1, main = "Site scores: solid=actual, dashed=calibrated",
          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

    ## End(Not run)

[Package VGAM version 1.0-4 Index]