fit.trending_model {trending}R Documentation

Fit method for trending_model objects

Description

Fits the specified model to the input data

Usage

## S3 method for class 'trending_model'
fit(x, data, as_tibble = TRUE, ...)

Arguments

x

An R object

data

A data frame containing the data to fit.

as_tibble

Should the output be converted to a tibble subclass.

...

Not currently used.

Value

If as_tibble = FALSE, then a trending_fit object is returned. This is a list subclass with entries:

If as_tibble = TRUE, a trending_fit_tbl object which is a tibble subclass with one row for each model and columns 'result', 'warnings' and 'errors' with contents as above.

Author(s)

Tim Taylor

See Also

fit.list()

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)

fit(poisson_model, dat)
fit(negbin_model, dat)
fit(list(poisson_model, negbin_model), dat)
fit(list(pm = poisson_model, nm = negbin_model), dat)


[Package trending version 0.1.0 Index]