You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The temp_holdout function resets the input time series to year 1, month 1. Since it requires the input to be a time series object, it should retain the start parameter of the input.
I've modified the function below.
function (dataset)
{
lapply(dataset, function(seriesentry) {
frq <- stats::frequency(seriesentry$x)
st <- stats::start(seriesentry$x)
if (length(seriesentry$x) - seriesentry$h < max(2 * frq +
1, 7)) {
length_to_keep <- max(2 * stats::frequency(seriesentry$x) +
1, 7)
seriesentry$h <- length(seriesentry$x) - length_to_keep
if (seriesentry$h < 2) {
warning(paste("cannot subset series by", 2 -
seriesentry$h, " observations, adding a mean constant"))
seriesentry$x <- stats::ts(c(seriesentry$x, rep(mean(seriesentry$x),
2 - seriesentry$h)), frequency = frq)
seriesentry$h <- 2
}
}
seriesentry$xx <- utils::tail(seriesentry$x, seriesentry$h)
seriesentry$x <- stats::ts(utils::head(seriesentry$x,
-seriesentry$h), frequency = frq, start=st)
if (!is.null(seriesentry$n)) {
seriesentry$n <- length(seriesentry$x)
}
seriesentry
})
}
The text was updated successfully, but these errors were encountered:
The temp_holdout function resets the input time series to year 1, month 1. Since it requires the input to be a time series object, it should retain the start parameter of the input.
I've modified the function below.
The text was updated successfully, but these errors were encountered: