library(tsibble)
library(dplyr)
# Create data with missing values
deaths_na <- as_tsibble(mdeaths) |>
mutate(value = if_else(row_number() %in% c(10, 20, 30), NA_real_, value))
# Fit model
fit <- deaths_na |>
model(FASSTER(value ~ trend(1) + fourier(12)))
# Interpolate missing values
interpolate(fit, deaths_na)
Run the code above in your browser using DataLab