From b33661279bd65b050f0125386ed8b27e0c3286b1 Mon Sep 17 00:00:00 2001 From: mitchelloharawild Date: Mon, 27 Nov 2023 18:14:56 +1100 Subject: [PATCH] Update NNETAR docs Resolves #405 --- NEWS.md | 4 ++++ R/nnetar.R | 6 +++++- man/forecast.NNETAR.Rd | 8 ++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 8158a8c8..3fb8cfb0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # fable (development version) +## Improvements + +* Documentation improvements. + # fable 0.3.3 Small patch to resolve CRAN check issues. diff --git a/R/nnetar.R b/R/nnetar.R index 195c6bec..93fd5b74 100644 --- a/R/nnetar.R +++ b/R/nnetar.R @@ -264,12 +264,16 @@ NNETAR <- function(formula, n_nodes = NULL, n_networks = 20, scale_inputs = TRUE #' @inherit forecast.ETS #' +#' @param simulate If `TRUE`, forecast distributions are produced by sampling from a normal distribution. Without simulation, forecast uncertainty cannot be estimated for this model and instead a degenerate distribution with the forecast mean will be produced. +#' @param bootstrap If `TRUE`, forecast distributions are produced by sampling from the model's training residuals. +#' @param times The number of sample paths to use in producing the forecast distribution. Setting `simulate = FALSE` or `times = 0` will produce degenerate forecast distributions of the forecast mean. +#' #' @examples #' as_tsibble(airmiles) %>% #' model(nn = NNETAR(box_cox(value, 0.15))) %>% #' forecast(times = 10) #' @export -forecast.NNETAR <- function(object, new_data, specials = NULL, simulate = TRUE, bootstrap = FALSE, times = 1000, ...) { +forecast.NNETAR <- function(object, new_data, specials = NULL, simulate = TRUE, bootstrap = FALSE, times = 5000, ...) { require_package("nnet") # Prepare xreg diff --git a/man/forecast.NNETAR.Rd b/man/forecast.NNETAR.Rd index 472596af..25543398 100644 --- a/man/forecast.NNETAR.Rd +++ b/man/forecast.NNETAR.Rd @@ -10,7 +10,7 @@ specials = NULL, simulate = TRUE, bootstrap = FALSE, - times = 1000, + times = 5000, ... ) } @@ -21,11 +21,11 @@ \item{specials}{(passed by \code{\link[fabletools:forecast]{fabletools::forecast.mdl_df()}}).} -\item{simulate}{If \code{TRUE}, prediction intervals are produced by simulation rather than using analytic formulae.} +\item{simulate}{If \code{TRUE}, forecast distributions are produced by sampling from a normal distribution. Without simulation, forecast uncertainty cannot be estimated for this model and instead a degenerate distribution with the forecast mean will be produced.} -\item{bootstrap}{If \code{TRUE}, then forecast distributions are computed using simulation with resampled errors.} +\item{bootstrap}{If \code{TRUE}, forecast distributions are produced by sampling from the model's training residuals.} -\item{times}{The number of sample paths to use in estimating the forecast distribution if simulated intervals are used.} +\item{times}{The number of sample paths to use in producing the forecast distribution. Setting \code{simulate = FALSE} or \code{times = 0} will produce degenerate forecast distributions of the forecast mean.} \item{...}{Other arguments passed to methods} }