รายงานการศึกษาค่าคาดการณ์อัตราการว่างงานของประเทศไทย
90 select(-Month) |> as_tsibble(index = Mth) data |> autoplot(UNEM) #### ARIMAX #### fit_unem <- data |> model(ARIMA(log(UNEM) ~ COVID, stepwise = F , approx=F)) report(fit_unem) unem_fc <- new_data(data, 60) |> mutate(COVID = 0) forecast(fit_unem, new_data = unem_fc) |> autoplot(data) + autolayer(fitted(fit_unem),col="blue", linewidth = 0.1) + labs(title="Unemployment ( 100%)" , y = "Unemployment") augment(fit_unem) |> features(.innov, ljung_box, dof = 6 , lag = 36) fit_unem |> accuracy() gg_tsresiduals(fit_unem) fc_unem <- forecast(fit_unem, new_data = unem_fc) View(fc_unem) View(tail(fitted(fit_unem), 12)) ## Train Test ## train_unem <- data |> filter_index(~ " 2020 Dec") test_unem <- data |> filter_index(" 2021 Jan"~.) fit_train_unem <- train_unem |> model(ARIMA(log(UNEM) ~ COVID, stepwise = F , approx=F)) report(fit_train_unem) fc_test_unem <- new_data(train_unem, 24) |> mutate(COVID = test_unem$COVID) forecast(fit_train_unem, new_data = fc_test_unem) |> autoplot(data) + autolayer(fitted(fit_train_unem),col="blue", linewidth = 0.1) + labs(title="Unemployment Train:Test)", y = "Unemployment") augment(fit_train_unem) |> features(.innov, ljung_box, dof = 6 , lag = 36) fit_train_unem |> accuracy() fit_train_unem |> forecast(new_data = fc_test_unem) |> accuracy(test_unem) gg_tsresiduals(fit_train_unem) fc_t_unem <- forecast(fit_train_unem, new_data = fc_test_unem) View(fc_t_unem) 2.3.3 อัตราการว่างงาน ## Data tsibble ## library(fpp 3) data <- Dataset_LF_UNEM_RATE_Forecast |> mutate(Mth = yearmonth(Month)) |> select(-Month) |> as_tsibble(index = Mth) data |> autoplot(UNEM_RATE) #### ARIMAX #### fit_rate <- data |>
Made with FlippingBook
RkJQdWJsaXNoZXIy MTA3NzA0Nw==