garch11Fit.Rd
Fits a GARCH(1,1) model to a time series using maximum likelihood estimation. This function estimates the parameters of the GARCH(1,1) model: \(\sigma_t^2 = \omega + \alpha \epsilon_{t-1}^2 + \beta \sigma_{t-1}^2\)
garch11Fit(x, return_model = TRUE)
If return_model = TRUE
, returns an object of class "garch11" containing:
coefficients
: Estimated parameters (mu, omega, alpha, beta)
data
: Original time series data
residuals
: Model residuals
sigma_squared
: Conditional variances
fitted_mean
: Fitted mean values
loglik
: Log-likelihood value
convergence
: Optimization convergence code
last_residual
: Last residual for forecasting
last_variance
: Last conditional variance for forecasting
stationarity
: Alpha + beta stationarity measure
If return_model = FALSE
, returns a coefficient matrix with estimates,
standard errors, t-values, and p-values.
garch11f
for forecasting with the fitted model
# \donttest{
# Generate sample GARCH(1,1) data
set.seed(123)
n <- 500
omega <- 0.1; alpha <- 0.1; beta <- 0.8; mu <- 0.05
y <- numeric(n)
sigma2 <- numeric(n)
sigma2[1] <- omega / (1 - alpha - beta)
y[1] <- mu + sqrt(sigma2[1]) * rnorm(1)
for (t in 2:n) {
sigma2[t] <- omega + alpha * (y[t-1] - mu)^2 + beta * sigma2[t-1]
y[t] <- mu + sqrt(sigma2[t]) * rnorm(1)
}
# Fit GARCH(1,1) model
model <- garch11Fit(y, return_model = TRUE)
#> Error in garch11Fit(y, return_model = TRUE): could not find function "garch11Fit"
print(model$coefficients)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'print': object 'model' not found
# }