Generates forecasts from a GARCH(1,1) model, similar in style to forecast::thetaf or forecast::meanf. Supports both analytical and bootstrap-based prediction intervals.

Generates forecasts from a GARCH(1,1) model, similar in style to forecast::thetaf or forecast::meanf. Supports both analytical and bootstrap-based prediction intervals.

garch11f(y, h = 5, B = 10L, seed = 123)

garch11f(y, h = 5, B = 10L, seed = 123)

Arguments

y

A numeric vector or time series object containing the data to forecast

h

Number of periods for forecasting (default: 10)

level

Confidence levels for prediction intervals (default: c(80, 95))

fan

Logical. If TRUE, level is set to seq(51, 99, by = 3) (default: FALSE)

bootstrap

Logical. If TRUE, uses bootstrap method for prediction intervals (default: FALSE)

npaths

Number of bootstrap paths when bootstrap = TRUE (default: 1000)

Value

An object of class "garch11forecast" containing:

  • model: The fitted GARCH(1,1) model object

  • method: Method name ("GARCH(1,1)")

  • mean: Point forecasts (time series)

  • variance: Forecasted conditional variances (time series)

  • lower: Lower prediction bounds (matrix)

  • upper: Upper prediction bounds (matrix)

  • level: Confidence levels used

  • x: Original time series

  • fitted: Fitted values from the model

  • residuals: Model residuals

An object of class "garch11forecast" containing:

  • model: The fitted GARCH(1,1) model object

  • method: Method name ("GARCH(1,1)")

  • mean: Point forecasts (time series)

  • variance: Forecasted conditional variances (time series)

  • lower: Lower prediction bounds (matrix)

  • upper: Upper prediction bounds (matrix)

  • level: Confidence levels used

  • x: Original time series

  • fitted: Fitted values from the model

  • residuals: Model residuals

See also

garch11Fit for model fitting, plot.garch11forecast for plotting forecasts

garch11Fit for model fitting, plot.garch11forecast for plotting forecasts

Examples

# \donttest{
# Generate sample data
set.seed(123)
n <- 200
y <- rnorm(n)  # Simple example with normal data

# Generate forecasts
forecasts <- garch11f(y, h = 20, level = c(80, 95))
#> Error in garch11f(y, h = 20, level = c(80, 95)): could not find function "garch11f"
print(forecasts)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'print': object 'forecasts' not found
plot(forecasts)
#> Error: object 'forecasts' not found

# Use bootstrap method
forecasts_boot <- garch11f(y, h = 20, bootstrap = TRUE, npaths = 500)
#> Error in garch11f(y, h = 20, bootstrap = TRUE, npaths = 500): could not find function "garch11f"
plot(forecasts_boot, main = "Bootstrap GARCH Forecasts")
#> Error: object 'forecasts_boot' not found
# }

# \donttest{
# Generate sample data
set.seed(123)
n <- 200
y <- rnorm(n)  # Simple example with normal data

# Generate forecasts
forecasts <- garch11f(y, h = 20, level = c(80, 95))
#> Error in garch11f(y, h = 20, level = c(80, 95)): could not find function "garch11f"
print(forecasts)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'print': object 'forecasts' not found
plot(forecasts)
#> Error: object 'forecasts' not found

# Use bootstrap method
forecasts_boot <- garch11f(y, h = 20, bootstrap = TRUE, npaths = 500)
#> Error in garch11f(y, h = 20, bootstrap = TRUE, npaths = 500): could not find function "garch11f"
plot(forecasts_boot, main = "Bootstrap GARCH Forecasts")
#> Error: object 'forecasts_boot' not found
# }