dorem() fits a model.

dorem(x, ...)

# S3 method for default
dorem(x, ...)

# S3 method for data.frame
dorem(x, y, ...)

# S3 method for matrix
dorem(x, y, ...)

# S3 method for formula
dorem(formula, data, ...)

# S3 method for recipe
dorem(x, data, ...)

Arguments

x

Depending on the context:

  • A data frame of predictors.

  • A matrix of predictors.

  • A recipe specifying a set of preprocessing steps created from recipes::recipe().

...

Not currently used, but required for extensibility.

y

When x is a data frame or matrix, y is the outcome specified as:

  • A data frame with 1 numeric column.

  • A matrix with 1 numeric column.

  • A numeric vector.

formula

A formula specifying the outcome terms on the left-hand side, and the predictor terms on the right-hand side.

data

When a recipe or formula is used, data is specified as:

  • A data frame containing both the predictors and the outcome.

Value

A dorem object.

Examples

require(tidyverse)
#> Loading required package: tidyverse
#> ── Attaching packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──
#> ggplot2 3.3.2 purrr 0.3.4 #> tibble 3.0.3 dplyr 1.0.1 #> tidyr 1.1.1 stringr 1.4.0 #> readr 1.3.1 forcats 0.5.0
#> Warning: package ‘tidyr’ was built under R version 4.0.2
#> Warning: package ‘dplyr’ was built under R version 4.0.2
#> ── Conflicts ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ── #> x dplyr::filter() masks stats::filter() #> x dplyr::lag() masks stats::lag()
data("bike_score") banister_model <- dorem( Test_5min_Power ~ BikeScore, bike_score, method = "banister" )
#> Performing banister method using L-BFGS-B optimization
#> Training the model...
#> Done!
bike_score$pred <- predict(banister_model, bike_score)$.pred ggplot(bike_score, aes(x = Day, y = pred)) + theme_bw() + geom_line() + geom_point(aes(y = Test_5min_Power), color = "red") + ylab("Test 5min Power")
#> Warning: Removed 156 rows containing missing values (geom_point).