Learn R Programming

glmSTARMA (version 1.0.0)

coef.glmstarma: Extract Coefficients of glmstarma and dglmstarma Models

Description

Extracts model coefficients from objects of class glmstarma and dglmstarma.

Usage

# S3 method for glmstarma
coef(object, asList = FALSE)

# S3 method for dglmstarma coef(object, asList = FALSE)

Value

A numeric vector, or a list, of model coefficients.

Arguments

object

An object of class glmstarma or dglmstarma

asList

Logical; if TRUE, returns coefficients as a list, or otherwise as a numeric vector. Default is FALSE.

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))
coef(fit)
coef(fit, asList = TRUE)

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))
coef(fit2)
coef(fit2, asList = TRUE)
# }

Run the code above in your browser using DataLab