Learn R Programming

VGAM (version 1.0-5)

BICvlm: Bayesian Information Criterion

Description

Calculates the Bayesian information criterion (BIC) for a fitted model object for which a log-likelihood value has been obtained.

Usage

BICvlm(object, …, k = log(nobs(object)))

Arguments

object, …

Same as AICvlm.

k

Numeric, the penalty per parameter to be used; the default is log(n) where n is the number of observations).

Value

Returns a numeric value with the corresponding BIC, or …, depending on k.

Warning

Like AICvlm, this code has not been double-checked. The general applicability of BIC for the VGLM/VGAM classes has not been developed fully. In particular, BIC should not be run on some VGAM family functions because of violation of certain regularity conditions, etc.

Many VGAM family functions such as cumulative can have the number of observations absorbed into the prior weights argument (e.g., weights in vglm), either before or after fitting. Almost all VGAM family functions can have the number of observations defined by the weights argument, e.g., as an observed frequency. BIC simply uses the number of rows of the model matrix, say, as defining n, hence the user must be very careful of this possible error. Use at your own risk!!

Details

The so-called BIC or SBC (Schwarz's Bayesian criterion) can be computed by calling AICvlm with a different k argument. See AICvlm for information and caveats.

See Also

AICvlm, VGLMs are described in vglm-class; VGAMs are described in vgam-class; RR-VGLMs are described in rrvglm-class; BIC, AIC.

Examples

Run this code
# NOT RUN {
pneumo <- transform(pneumo, let = log(exposure.time))
(fit1 <- vglm(cbind(normal, mild, severe) ~ let,
              cumulative(parallel = TRUE, reverse = TRUE), data = pneumo))
coef(fit1, matrix = TRUE)
BIC(fit1)
(fit2 <- vglm(cbind(normal, mild, severe) ~ let,
              cumulative(parallel = FALSE, reverse = TRUE), data = pneumo))
coef(fit2, matrix = TRUE)
BIC(fit2)

# These do not agree in absolute terms:
gdata <- data.frame(x2 = sort(runif(n <- 40)))
gdata <- transform(gdata, y1 = 1 + 2*x2 + rnorm(n, sd = 0.1))
fit.v <- vglm(y1 ~ x2, gaussianff, data = gdata)
fit.g <-  glm(y1 ~ x2, gaussian  , data = gdata)
fit.l <-   lm(y1 ~ x2, data = gdata)
c(BIC(fit.l), BIC(fit.g), BIC(fit.v))
c(AIC(fit.l), AIC(fit.g), AIC(fit.v))
c(AIC(fit.l) - AIC(fit.v),
  AIC(fit.g) - AIC(fit.v))
c(logLik(fit.l), logLik(fit.g), logLik(fit.v))
# }

Run the code above in your browser using DataLab