dorem: Fit a 'dorem'

View source: R/dorem-fit.R

doremR Documentation

Fit a dorem

Description

dorem() fits a model.

Usage

dorem(x, ...)

## Default S3 method:
dorem(x, ...)

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

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

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

## S3 method for class '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)

data("bike_score")

banister_model <- dorem(
  Test_5min_Power ~ BikeScore,
  bike_score,
  method = "banister"
)

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")

mladenjovanovic/dorem documentation built on July 23, 2022, 7:12 a.m.