Learn R Programming

garchx (version 1.6)

refit: Refit a model to new data

Description

Refit a model to new data, typically for cross-validation purposes. Re-estimation (reestimate) is optional (the default is FALSE).

Usage

##generic:
refit(object, ...)

##S3 method for 'garchx' objects: # S3 method for garchx refit(object, newy = NULL, newxreg = NULL, backcast.value = NULL, reestimate = FALSE, ...)

Value

A list of class 'garchx'

Arguments

object

an object of class garchx

newy

vector, the new 'y' data, see garchx

newxreg

the new 'xreg' data, if any, see garchx

backcast.value

NULL or a non-negative numeric, see garchx

reestimate

logical. If FALSE (default), then the estimates from object are used on the new data. If TRUE, then the model is re-estimated using the new data

...

further arguments passed to or from other methods

Author

Genaro Sucarrat, https://www.sucarrat.net/

Details

refit.garchx is a convenience function to facilitate cross-validation and related analyses.

See Also

garchx

Examples

Run this code
##simulate from a garch(1,1):
set.seed(123)
y <- garchxSim(1000)

##estimate garch(1,1) model:
mymod <- garchx(y)

##new data (e.g. 'out-of-sample' or 'test' data):
yy <- garchxSim(100)

##apply the estimates of 'mymod' on yy data:
refit(mymod, newy=yy)

Run the code above in your browser using DataLab