The exact code can be found on github: https://github.com/tidyverts/tidy-forecasting-principles/blob/master/03-model-methods.Rmd
library(tidyverse)
library(tsibbledata)
library(fable)
#> Loading required package: fabletools
olympic_complete <- olympic_running %>%
model(lm = TSLM(Time ~ trend())) %>%
interpolate(olympic_running)
olympic_running %>%
ggplot(aes(x=Year, y = Time, colour = Sex)) +
geom_line(aes(linetype = "Interpolated"), data = olympic_complete) +
geom_line(aes(linetype = "Actual")) +
geom_point(size = 1) +
facet_wrap(~ Length, scales = "free_y", nrow = 2) +
theme_minimal() +
scale_color_brewer(palette = "Dark2") +
theme(legend.position = "bottom", legend.title = element_blank()) +
ylab("Running time (seconds)")
#> Warning: Removed 31 rows containing missing values (geom_point).

Created on 2020-06-28 by the reprex package (v0.3.0)