Question
library(fpp3) library(dplyr) library(tsibble) # Load the data and create tsibble myseries % select(date, value) %>% mutate(Month = yearmonth(date)) %>% as_tsibble(index = Month) # Split the
library(fpp3) library(dplyr) library(tsibble)
# Load the data and create tsibble myseries <- read_abs_series("A84424387A", release_date="2024-01-01") %>% select(date, value) %>% mutate(Month = yearmonth(date)) %>% as_tsibble(index = Month)
# Split the data into training and test sets training_set <- myseries %>% filter(Month <= yearmonth("2020-02"))
test_set <- myseries %>% filter(Month > yearmonth("2020-02"))
# Fit the Holt-Winters multiplicative model with log transformation hw_model <- training_set %>% model( HW = ETS(log(value) ~ error("M") + trend("A") + season("M")) )
# Forecast for the length of the test set hw_forecast <- hw_model %>% forecast(h = nrow(test_set))
# Plot the training data and the forecast final_plot <- autoplot(myseries, value) + autolayer(hw_forecast, .id = "series") + labs(title = "Holt-Winters' Multiplicative Forecast for Female Students Working and Studying Full-Time", x = "Year and Month", y = "Number of Students (in thousands)")
print(final_plot) is the code above correct for part c ii) in the attached.
The other photo is the output of the above code. I am worried that its wrong as the predicted values seem to explode.