fit: Fit generic

View source: R/fit.R

fitR Documentation

Fit generic

Description

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

Usage

fit(x, data, ...)

## Default S3 method:
fit(x, data, ...)

Arguments

x

An R object

data

A data frame containing the data to fit.

...

Arguments passed to underlying methods.

Value

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

Author(s)

Tim Taylor

See Also

fit.trending_model() and 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)


trending documentation built on April 4, 2023, 1:07 a.m.