Learn R Programming

glmSTARMA (version 1.0.0)

information_criteria: Information Criteria for glmstarma and dglmstarma objects

Description

Compute AIC, BIC, and QIC and (Quasi-)log-likelihood for glmstarma and dglmstarma objects.

Usage

# S3 method for glmstarma
AIC(object, k = 2, adjust = TRUE)

# S3 method for dglmstarma AIC(object, k = 2, adjust = TRUE)

# S3 method for glmstarma BIC(object, adjust = TRUE)

# S3 method for dglmstarma BIC(object, adjust = TRUE)

# S3 method for glmstarma logLik(object, adjust = TRUE)

# S3 method for dglmstarma logLik(object, adjust = TRUE)

Value

A numeric value for the (possibly adjusted) AIC, BIC, QIC or (quasi-)log-likelihood.

Arguments

object

An object of class glmstarma or dglmstarma

k

Numeric; penalty per parameter to be used. Default is 2 (standard AIC).

adjust

Logical; if TRUE (default), the (quasi-)log-likelihood is adjusted for the effective sample size. See Details.

Details

During model fitting, the (quasi-)log-likelihood is computed only on the last n_eff time-points, where n_eff = n - max_time_lag_mean - max_time_lag_dispersion. Here n is the total number of time-points, max_time_lag_mean the maximum temporal lag in the mean model, and max_time_lag_dispersion the maximum temporal lag in the dispersion model (for dglmstarma objects). If no dispersion model is present (class glmstarma), max_time_lag_dispersion is zero.

To be more specific the (quasi-)log-likelihood calculated during model estimation is given by $$\ell(\mathbf{\theta}) = \sum_{t = \tau}^n \sum_{i = 1}^p \ell_{i, t}(\mathbf{\theta}),$$ where \(\ell_{i, t}(\mathbf{\theta})\) denotes the (quasi-)log-likelihood of the observation at location \(i\) at time \(t\), and \(\tau = n - n_{\mathrm{eff}}\).

This calculation of the (quasi-)log-likelihood introduces bias when comparing models of different temporal orders. If adjust = TRUE, the (quasi-)log-likelihood is rescaled to n observations by multiplying with \(n / n_{\mathrm{eff}}\), before calculating the AIC, BIC, QIC or (quasi)-log-likelihood.

See Also

AIC, BIC, logLik, QIC

Examples

Run this code
# \donttest{
dat <- load_data("chickenpox", directory = tempdir())
chickenpox <- dat$chickenpox
population_hungary <- dat$population_hungary
W_hungary <- dat$W_hungary

model_autoregressive <- list(past_obs = rep(1, 7))
fit <- glmstarma(chickenpox, model_autoregressive, W_hungary, family = vpoisson("log"),
                 covariates = list(population = population_hungary))
AIC(fit)
BIC(fit)
logLik(fit)
QIC(fit)

mean_model <- list(past_obs = rep(1, 7))
dispersion_model <- list(past_obs = 1)
fit2 <- dglmstarma(chickenpox, mean_model, dispersion_model, mean_family = vquasipoisson("log"),
                   dispersion_link = "log",
                   wlist = W_hungary, 
                   mean_covariates = list(population = population_hungary))
AIC(fit2)
BIC(fit2)
logLik(fit2)
QIC(fit2)
# }

Run the code above in your browser using DataLab