trending (version 0.1.0)

fit: Fit generic

Description

fit() is a generic to fit a specified model.

Usage

fit(x, data, ...)

# S3 method for default fit(x, data, ...)

Value

The value returned depends on the class of the input argument.

Arguments

x

An R object

data

A data frame containing the data to fit.

...

Arguments passed to underlying methods.

Author

Tim Taylor

See Also

fit.trending_model() and fit.list()

Examples

Run this code
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)

Run the code above in your browser using DataLab