refit: Refit the model with randomly generated initial parameters...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

refit function generates the parameters based on the values in the provided object and then reapplies the same model with those parameters to the data, getting the fitted paths and updated states. reforecast function uses those values in order to produce forecasts for the h steps ahead.

Usage

1
2
3
4
5
6
refit(object, nsim = 1000, bootstrap = FALSE, ...)

reforecast(object, h = 10, newdata = NULL, occurrence = NULL,
  interval = c("prediction", "confidence", "none"), level = 0.95,
  side = c("both", "upper", "lower"), cumulative = FALSE, nsim = 100,
  ...)

Arguments

object

Model estimated using one of the functions of smooth package.

nsim

Number of paths to generate (number of simulations to do).

bootstrap

The logical, which determines, whether to use bootstrap for the covariance matrix of parameters or not.

...

Other parameters passed to mean() function in case of reforecast (this mainly refers to trim variable, which is set to 0.01 by default) and to vcov in case of refit.

h

Forecast horizon.

newdata

The new data needed in order to produce forecasts.

occurrence

The vector containing the future occurrence variable (values in [0,1]), if it is known.

interval

What type of mechanism to use for interval construction. The options include interval="none", interval="prediction" (prediction intervals) and interval="confidence" (intervals for the point forecast). The other options are not supported and do not make much sense for the refitted model.

level

Confidence level. Defines width of prediction interval.

side

Defines, whether to provide "both" sides of prediction interval or only "upper", or "lower".

cumulative

If TRUE, then the cumulative forecast and prediction interval are produced instead of the normal ones. This is useful for inventory control systems.

Details

The main motivation of the function is to take the randomness due to the in-sample estimation of parameters into account when fitting the model and to propagate this randomness to the forecasts. The methods can be considered as a special case of recursive bootstrap.

Value

refit() returns object of the class "refit", which contains:

reforecast() returns the object of the class forecast.smooth, which contains in addition to the standard list the variable paths - all simulated trajectories with h in rows, simulated future paths for each state in columns and different states (obtained from refit() function) in the third dimension.

Author(s)

Ivan Svetunkov, ivan@svetunkov.ru

See Also

forecast.smooth

Examples

1
2
3
4
5
6
7
8
x <- rnorm(100,0,1)

# Just as example. orders and lags do not return anything for ces() and es(). But modelType() does.
ourModel <- adam(x, "ANN")
refittedModel <- refit(ourModel, nsim=50)
plot(refittedModel)

ourForecast <- reforecast(ourModel, nsim=50)

config-i1/smooth documentation built on June 16, 2021, 2:13 p.m.