evaluate_aic {trendeval}R Documentation

Generic for calculating the AIC

Description

evaluate_aic() is a a generic for evaluating the Akaike's 'An Information Criterion' for a given input

Usage

evaluate_aic(x, ...)

## Default S3 method:
evaluate_aic(x, ...)

## S3 method for class 'trending_model'
evaluate_aic(x, data, as_tibble = FALSE, ...)

## S3 method for class 'list'
evaluate_aic(x, data, ...)

Arguments

x

An R object.

...

Not currently used.

data

a data.frame containing data (including the response variable and all predictors) used in the specified model.

as_tibble

Should the result be returned as tibble (as_tibble = TRUE) or a list (as_tibble = FALSE).

Details

Specific methods are given for trending_fit and lists of these models.

Value

If as_tibble = TRUE, or the input is a list of models then the output will be a tibble with one row for each fitted model columns corresponding to output generated with single model input.

Author(s)

Tim Taylor

#' @examples x = rnorm(100, mean = 0) y = rpois(n = 100, lambda = exp(1.5 + 0.5*x)) dat <- data.frame(x = x, y = y) poisson_model <- glm_model(y ~ x , family = "poisson") negbin_model <- glm_nb_model(y ~ x)

evaluate_aic(poisson_model, dat) evaluate_aic(list(poisson_model, negbin_model), data = dat)


[Package trendeval version 0.1.0 Index]