trending (version 0.0.2)

fit: Fitting for trending_model objects

Description

fit() fits a model using the given data to obtain an object of type trending_model_fit or trending_model_fit_list.

Usage

fit(x, data, ...)

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

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

Arguments

x

The output of functions lm_model, glm_model, glm_nb_model, or brms_model or a list of these objects.

data

A data.frame to be used to train the model.

...

Additional arguments passed to underlying models.

Examples

Run this code
# NOT RUN {
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(list(poisson_model, negbin_model), dat)

# }

Run the code above in your browser using DataCamp Workspace