Skip to content

Commit

Permalink
Week 12 solutions no longer hard code knot
Browse files Browse the repository at this point in the history
  • Loading branch information
robjhyndman committed Jun 4, 2024
1 parent c46cb7a commit a27dada
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions week12/ex12-sol.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ best_model |> report()

The optimal knot (to 1 decimal place) is `r best_knot` degrees Celsius.


```{r ex3check, include = FALSE}
if(abs(best_knot - 28.1) > 1e-5)
stop("Optimal knot is not 28.1")
```

```{r ex3d}
augment(best_model) |>
left_join(vic_elec_daily) |>
Expand All @@ -133,15 +127,15 @@ The model fails the residual tests but the significant autocorrelations are rela
vic_next_day <- new_data(vic_elec_daily, 1) |>
mutate(
Temperature = 26,
Temp2 = I(pmax(Temperature - 28.4, 0)),
Temp2 = I(pmax(Temperature - best_knot, 0)),
Day_Type = "Holiday"
)
forecast(best_model, vic_next_day)
vic_elec_future <- new_data(vic_elec_daily, 14) |>
mutate(
Temperature = 26,
Temp2 = I(pmax(Temperature - 28.4, 0)),
Temp2 = I(pmax(Temperature - best_knot, 0)),
Holiday = c(TRUE, rep(FALSE, 13)),
Day_Type = case_when(
Holiday ~ "Holiday",
Expand Down

0 comments on commit a27dada

Please sign in to comment.