Learn R Programming

VGAM (version 1.1-6)

calibrate.rrvglm: Calibration for CLO models (RR-VGLMs)

Description

Performs maximum likelihood calibration for constrained linear ordination models (CLO models are better known as RR-VGLMs).

Usage

calibrate.rrvglm(object, newdata = NULL,
    type = c("latvar", "predictors", "response", "vcov", "everything"),
    lr.confint = FALSE, cf.confint = FALSE,
    level = 0.95, initial.vals = NULL, ...)

Arguments

object

The fitted rrvglm model. Note that object should be fitted with corner constraints.

newdata
type

See calibrate.qrrvglm. If type = "vcov" then object should have been fitted using binomialff or poissonff with canonical links, and have noRRR = ~ 1.

lr.confint, cf.confint, level
initial.vals

Same as calibrate.qrrvglm. The default is a grid defined by arguments in calibrate.rrvglm.control.

Arguments that are fed into calibrate.rrvglm.control.

Value

See calibrate.qrrvglm. Of course, the quadratic term in the latent variables vanishes for RR-VGLMs, so the model is simpler.

Warning

See calibrate.qrrvglm.

Details

Given a fitted regression CLO model, maximum likelihood calibration is theoretically easy and elegant. However, the method assumes that all responses are independent. More details and references are given in Yee (2015).

Calibration requires grouped or non-sparse data as the response. For example, if the family function is multinomial then one cannot usually calibrate y0 if it is a vector of 0s except for one 1. Instead, the response vector should be from grouped data so that there are few 0s. Indeed, it is found empirically that the stereotype model (also known as a reduced-rank multinomial logit model) calibrates well only with grouped data, and if the response vector is all 0s except for one 1 then the MLE will probably be at -Inf or +Inf. As another example, if the family function is poissonff then y0 must not be a vector of all 0s; instead, the response vector should have few 0s ideally. In general, you can use simulation to see what type of data calibrates acceptably.

Internally, this function is a simplification of calibrate.qrrvglm and users should look at that function for details. Good initial values are needed, and a grid is constructed to obtain these. The function calibrate.rrvglm.control allows the user some control over the choice of these.

See Also

calibrate.qrrvglm, calibrate, rrvglm, weightsvglm, optim, uniroot.

Examples

Run this code
# NOT RUN {
  # Example 1
nona.xs.nz <- na.omit(xs.nz)  # Overkill!! (Data in VGAMdata package)
nona.xs.nz$dmd     <- with(nona.xs.nz, round(drinkmaxday))
nona.xs.nz$feethr  <- with(nona.xs.nz, round(feethour))
nona.xs.nz$sleephr <- with(nona.xs.nz, round(sleep))
nona.xs.nz$beats   <- with(nona.xs.nz, round(pulse))

p2 <- rrvglm(cbind(dmd, feethr, sleephr, beats) ~ age + smokenow +
  depressed + embarrassed + fedup + hurt + miserable +  # 11 psychological
  nofriend + moody + nervous + tense + worry + worrier, # variables
  noRRR = ~ age + smokenow, trace = FALSE, poissonff, data = nona.xs.nz,
  Rank = 2)
cp2 <- calibrate(p2, newdata = head(nona.xs.nz, 9), trace = TRUE)
cp2

two.cases <- nona.xs.nz[1:2, ]  # Another calibration example
two.cases$dmd       <- c(4, 10)
two.cases$feethr    <- c(4, 7)
two.cases$sleephr   <- c(7, 8)
two.cases$beats     <- c(62, 71)
(cp2b <- calibrate(p2, newdata = two.cases))

# Example 2
p1 <- rrvglm(cbind(dmd, feethr, sleephr, beats) ~ age + smokenow +
  depressed + embarrassed + fedup + hurt + miserable +  # 11 psychological
  nofriend + moody + nervous + tense + worry + worrier, # variables
  noRRR = ~ age + smokenow, trace = FALSE, poissonff, data = nona.xs.nz,
  Rank = 1)
(cp1c <- calibrate(p1, newdata = two.cases, lr.confint = TRUE))
# }

Run the code above in your browser using DataLab