Uses a fitted model to interpolate missing values from a dataset.

# S3 method for class 'mdl_df'
interpolate(object, new_data, ...)

# S3 method for class 'mdl_ts'
interpolate(object, new_data, ...)

Arguments

object

A mable containing a single model column.

new_data

A dataset with the same structure as the data used to fit the model.

...

Other arguments passed to interpolate methods.

Examples

library(fable)
library(tsibbledata)

# The fastest running times for the olympics are missing for years during 
# world wars as the olympics were not held.
olympic_running
#> # A tsibble: 312 x 4 [4Y]
#> # Key:       Length, Sex [14]
#>     Year Length Sex    Time
#>    <int>  <int> <chr> <dbl>
#>  1  1896    100 men    12  
#>  2  1900    100 men    11  
#>  3  1904    100 men    11  
#>  4  1908    100 men    10.8
#>  5  1912    100 men    10.8
#>  6  1916    100 men    NA  
#>  7  1920    100 men    10.8
#>  8  1924    100 men    10.6
#>  9  1928    100 men    10.8
#> 10  1932    100 men    10.3
#> # ℹ 302 more rows

olympic_running %>% 
  model(TSLM(Time ~ trend())) %>% 
  interpolate(olympic_running)
#> # A tsibble: 312 x 4 [4Y]
#> # Key:       Length, Sex [14]
#>    Length Sex    Year  Time
#>     <int> <chr> <int> <dbl>
#>  1    100 men    1896  12  
#>  2    100 men    1900  11  
#>  3    100 men    1904  11  
#>  4    100 men    1908  10.8
#>  5    100 men    1912  10.8
#>  6    100 men    1916  10.8
#>  7    100 men    1920  10.8
#>  8    100 men    1924  10.6
#>  9    100 men    1928  10.8
#> 10    100 men    1932  10.3
#> # ℹ 302 more rows