Extracts the fitted values.
# S3 method for class 'RW'
fitted(object, ...)
A vector of fitted values.
as_tsibble(Nile) %>%
model(NAIVE(value)) %>%
fitted()
#> # A tsibble: 100 x 3 [1Y]
#> # Key: .model [1]
#> .model index .fitted
#> <chr> <dbl> <dbl>
#> 1 NAIVE(value) 1871 NA
#> 2 NAIVE(value) 1872 1120
#> 3 NAIVE(value) 1873 1160
#> 4 NAIVE(value) 1874 963
#> 5 NAIVE(value) 1875 1210
#> 6 NAIVE(value) 1876 1160
#> 7 NAIVE(value) 1877 1160
#> 8 NAIVE(value) 1878 813
#> 9 NAIVE(value) 1879 1230
#> 10 NAIVE(value) 1880 1370
#> # ℹ 90 more rows
library(tsibbledata)
aus_production %>%
model(snaive = SNAIVE(Beer ~ lag("year"))) %>%
fitted()
#> # A tsibble: 218 x 3 [1Q]
#> # Key: .model [1]
#> .model Quarter .fitted
#> <chr> <qtr> <dbl>
#> 1 snaive 1956 Q1 NA
#> 2 snaive 1956 Q2 NA
#> 3 snaive 1956 Q3 NA
#> 4 snaive 1956 Q4 NA
#> 5 snaive 1957 Q1 284
#> 6 snaive 1957 Q2 213
#> 7 snaive 1957 Q3 227
#> 8 snaive 1957 Q4 308
#> 9 snaive 1958 Q1 262
#> 10 snaive 1958 Q2 228
#> # ℹ 208 more rows