Rows: 1456 Columns: 24
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): city
dbl (22): year, weekofyear, ndvi_ne, ndvi_nw, ndvi_se, ndvi_sw, precipitati...
date (1): week_start_date
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1456 Columns: 4
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): city
dbl (3): year, weekofyear, total_cases
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Warning: There were 2 warnings in `mutate()`.
The first warning was:
ℹ In argument: `spline_lm = (function (object, ...) ...`.
Caused by warning:
! prediction from a rank-deficient fit may be misleading
ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
iq_fc <- iq_fit |>forecast(iq_test)
Plot forecasts against test set
sj_fc |>autoplot(bind_rows(sj_train, sj_test),level =NULL ) +labs(title ="Forecasted weekly case count for SJ",subtitle ="Colored lines are forecasted values from training data" )
`mutate_if()` ignored the following grouping variables:
• Column `city`
iq_fc |>autoplot(bind_rows(iq_train, iq_test),level =NULL ) +labs(title ="Forecasted weekly case count for IQ",subtitle ="Colored lines are forecasted values from training data" )
`mutate_if()` ignored the following grouping variables:
• Column `city`
Plot variable not specified, automatically selected `y = .mean`
Warning: The output of `fortify(<fable>)` has changed to better suit usage with the ggdist package.
If you're using it to extract intervals, consider using `hilo()` to compute intervals, and `unpack_hilo()` to obtain values.
Plot variable not specified, automatically selected `y = .mean`
Warning: The output of `fortify(<fable>)` has changed to better suit usage with the ggdist package.
If you're using it to extract intervals, consider using `hilo()` to compute intervals, and `unpack_hilo()` to obtain values.
Forecast with best model
test <- readr::read_csv(here::here("final_project/data", "dengue_features_test.csv"))
Rows: 416 Columns: 24
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): city
dbl (22): year, weekofyear, ndvi_ne, ndvi_nw, ndvi_se, ndvi_sw, precipitati...
date (1): week_start_date
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
test <- test |>select(-c("year", "weekofyear")) |>mutate(date =yearweek(week_start_date)) |>as_tsibble(index = date, key = city)test <-impute_missing_by_mean(test)
sj_test <- test |>filter(city =="sj")iq_test <- test |>filter(city =="iq")
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `spline_lm = (function (object, ...) ...`.
Caused by warning:
! prediction from a rank-deficient fit may be misleading