reapply {smooth} | R Documentation |
Reapply the model with randomly generated initial parameters and produce forecasts
Description
reapply
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
reapply(object, nsim = 1000, bootstrap = FALSE, heuristics = NULL, ...)
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. |
heuristics |
The value for proportion to use for heuristic estimation of the
standard deviation of parameters. If |
... |
Other parameters passed to |
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 |
level |
Confidence level. Defines width of prediction interval. |
side |
Defines, whether to provide |
cumulative |
If |
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
reapply()
returns object of the class "reapply", which contains:
-
timeElapsed
- Time elapsed for the code execution; -
y
- The actual values; -
states
- The array of states of the model; -
refitted
- The matrix with fitted values, where columns correspond to different paths; -
fitted
- The vector of fitted values (conditional mean); -
model
- The name of the constructed model; -
transition
- The array of transition matrices; -
measurement
- The array of measurement matrices; -
persistence
- The matrix of persistence vectors (paths in columns); -
profile
- The array of profiles obtained by the end of each fit.
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 reapply()
function) in the
third dimension.
Author(s)
Ivan Svetunkov, ivan@svetunkov.ru
See Also
Examples
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 <- reapply(ourModel, nsim=50)
plot(refittedModel)
ourForecast <- reforecast(ourModel, nsim=50)