predict.dorem: Predict from a 'dorem'

View source: R/dorem-predict.R

predict.doremR Documentation

Predict from a dorem

Description

Predict from a dorem

Usage

## S3 method for class 'dorem'
predict(object, new_data, type = "numeric", ...)

Arguments

object

A dorem object.

new_data

A data frame or matrix of new predictors.

type

A single character. The type of predictions to generate. Valid options are:

  • "numeric" for numeric predictions.

...

Not used, but required for extensibility.

Value

A tibble of predictions. The number of rows in the tibble is guaranteed to be the same as the number of rows in new_data.

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.