From 30ce194c6caee1bb7f28a543b6a1fe4a0747fb0e Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 23 Apr 2024 11:00:40 +1000 Subject: [PATCH] typo fix --- R/forecast.mvgam.R | 4 +++- R/hindcast.mvgam.R | 8 ++++---- R/mvgam.R | 2 +- R/plot_mvgam_resids.R | 8 ++++++-- src/mvgam.dll | Bin 1084416 -> 1084416 bytes 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/R/forecast.mvgam.R b/R/forecast.mvgam.R index 7eed0ff3..005e9f72 100644 --- a/R/forecast.mvgam.R +++ b/R/forecast.mvgam.R @@ -202,7 +202,9 @@ forecast.mvgam = function(object, names(series_fcs) <- levels(data_test$series) # Extract hindcasts - data_train <- object$obs_data + data_train <- validate_series_time(object$obs_data, + trend_model = attr(object$model_data, + 'trend_model')) ends <- seq(0, dim(mcmc_chains(object$model_output, 'ypred'))[2], length.out = NCOL(object$ytimes) + 1) starts <- ends + 1 diff --git a/R/hindcast.mvgam.R b/R/hindcast.mvgam.R index 6349e777..4c98797d 100644 --- a/R/hindcast.mvgam.R +++ b/R/hindcast.mvgam.R @@ -172,10 +172,10 @@ hindcast.mvgam = function(object, names(series_hcs) <- levels(data_train$series) series_obs <- lapply(seq_len(n_series), function(series){ - s_name <- levels(object$obs_data$series)[series] - data.frame(series = object$obs_data$series, - time = object$obs_data$index..time..index, - y = object$obs_data$y) %>% + s_name <- levels(data_train$series)[series] + data.frame(series = data_train$series, + time = data_train$index..time..index, + y = data_train$y) %>% dplyr::filter(series == s_name) %>% dplyr::arrange(time) %>% dplyr::pull(y) diff --git a/R/mvgam.R b/R/mvgam.R index c333d742..bb1a6f20 100644 --- a/R/mvgam.R +++ b/R/mvgam.R @@ -322,7 +322,7 @@ #'mod1 <- mvgam(formula = y ~ s(season, bs = 'cc', k = 6), #' data = dat$data_train, #' trend_model = RW(), -#' family = poison(), +#' family = poisson(), #' use_stan = TRUE, #' run_model = FALSE) #' diff --git a/R/plot_mvgam_resids.R b/R/plot_mvgam_resids.R index fc3b637d..4d3f5f03 100644 --- a/R/plot_mvgam_resids.R +++ b/R/plot_mvgam_resids.R @@ -42,7 +42,9 @@ plot_mvgam_resids = function(object, series = 1, } if(!missing("newdata")){ - data_test <- newdata + data_test <- validate_series_time(newdata, + trend_model = attr(object$model_data, + 'trend_model')) } # Plotting colours @@ -55,7 +57,9 @@ c_dark <- c("#8F2727") c_dark_highlight <- c("#7C0000") # Prediction indices for the particular series -data_train <- object$obs_data +data_train <- validate_series_time(object$obs_data, + trend_model = attr(object$model_data, + 'trend_model')) ends <- seq(0, dim(mcmc_chains(object$model_output, 'ypred'))[2], length.out = NCOL(object$ytimes) + 1) starts <- ends + 1 diff --git a/src/mvgam.dll b/src/mvgam.dll index bcee2ad40207ca2304ca0abd41f93423fc04acc2..4179f5cec28931ed2b8d5b20f0b97c9125c67ccf 100644 GIT binary patch delta 80 zcmV~$%MCz407cQ5@fm+zNbD%VUIDrpi5Bt!wXOXx{k;s2n0k delta 80 zcmV~$yA42K0EN-;d%qhB11NNipf`YRC~hLr&{;(6@-^0=bIyDY^EvFRsov(;M!S9% jge7cYgd<$x310*v6p@HUB2tlw{Gw<(Q@+jZ_r*8;x9=lP