oneStepAhead: Predictive Model Assessment for hhh4ZI Models

oneStepAheadR Documentation

Predictive Model Assessment for hhh4ZI Models

Description

Computes successive one-step-ahead predictions from a model fit. There is a method for hhh4 models from surveillance (see the documentation of oneStepAhead there) and a derived method for ZI-extended models fitted from hhh4ZI. The documentation of the arguments is inherited from the former; where "hhh4" is mentioned, "hhh4ZI" works interchangeably.

Predictions can be inspected using quantile, confint and plot methods.

Usage

oneStepAhead(result, tp, ...)

## S3 method for class 'hhh4'
oneStepAhead(
  result,
  tp,
  type = c("rolling", "first", "final"),
  which.start = c("current", "final"),
  keep.estimates = FALSE,
  verbose = type != "final",
  cores = 1,
  ...
)

## S3 method for class 'hhh4ZI'
oneStepAhead(
  result,
  tp,
  type = c("rolling", "first", "final"),
  which.start = c("current", "final"),
  keep.estimates = FALSE,
  verbose = TRUE,
  cores = 1,
  ...
)

## S3 method for class 'oneStepAhead_hhh4ZI'
quantile(x, probs = c(2.5, 10, 50, 90, 97.5)/100, ...)

## S3 method for class 'oneStepAhead_hhh4ZI'
confint(object, parm, level = 0.95, ...)

## S3 method for class 'oneStepAhead_hhh4ZI'
plot(x, unit = 1, probs = 1:99/100, start = NULL, ...)

Arguments

result

fitted hhh4 model (class "hhh4").

tp

numeric vector of length 2 specifying the time range in which to compute one-step-ahead predictions (for the time points tp[1]+1, ..., tp[2]+1). If a single time index is specified, it is interpreted as tp[1], and tp[2] is set to the penultimate time point of result$control$subset.

...

unused (argument of the generic).

type

The default "rolling" procedure sequentially refits the model up to each time point in tp and computes the one-step-ahead predictions for the respective next time point. The alternative types are no true one-step-ahead predictions but much faster: "first" will refit the model for the first time point tp[1] only and use this specific fit to calculate all subsequent predictions, whereas "final" will just use result to calculate these. The latter case thus gives nothing else than a subset of result$fitted.values if the tp's are part of the fitted subset result$control$subset.

which.start

Which initial parameter values should be used when successively refitting the model to subsets of the data (up to time point tp[1], up to tp[1]+1, ...) if type="rolling"? Default ("current") is to use the parameter estimates from the previous time point, and "final" means to always use the estimates from result as initial values. Alternatively, which.start can be a list of start values as expected by hhh4, which then replace the corresponding estimates from result as initial values. This argument is ignored for “non-rolling” types.

keep.estimates

logical indicating if parameter estimates and log-likelihoods from the successive fits should be returned.

verbose

non-negative integer (usually in the range 0:3) specifying the amount of tracing information to output. During hhh4 model updates, the following verbosity is used: 0 if cores > 1, otherwise verbose-1 if there is more than one time point to predict, otherwise verbose.

cores

the number of cores to use when computing the predictions for the set of time points tp in parallel (with mclapply). Note that parallelization is not possible in the default setting type="rolling" and which.start="current" (use which.start="final" for this to work).

x

an object of class "oneStepAhead" or "hhh4".

probs

numeric vector of probabilities with values in [0,1].

object

an object of class "oneStepAhead".

parm

unused (argument of the generic).

level

required confidence level of the prediction interval.

unit

single integer or character selecting a unit for which to produce the plot.

start

x-coordinate of the first prediction. If start=NULL (default), this is derived from x.


Junyi-L/hhh4ZI documentation built on Oct. 14, 2024, 11:45 p.m.