lik_garch: Calculate the log-likelihood of a time series of returns...

View source: R/RcppExports.R

lik_garchR Documentation

Calculate the log-likelihood of a time series of returns assuming a GARCH(1,1) process.

Description

Calculate the log-likelihood of a time series of returns assuming a GARCH(1,1) process.

Usage

lik_garch(omega, alpha, beta, returns, minval = 1e-06)

Arguments

omega

Parameter proportional to the long-term average level of variance.

alpha

The weight associated with recent realized variance updates.

beta

The weight associated with the past variance estimates.

returns

A single-column matrix of returns.

minval

The floor value applied to the variance, to avoid zero values. (The default is minval = 0.000001.)

Details

The function lik_garch() calculates the log-likelihood of a time series of returns assuming a GARCH(1,1) process.

It first estimates the rolling variance of the returns argument using function sim_garch():

\sigma^2_i = \omega + \alpha r^2_i + \beta \sigma_{i-1}^2

Where r_i is the time series of returns, and \sigma^2_i is the estimated rolling variance. And \omega, \alpha, and \beta are the GARCH parameters. It applies the floor value minval to the variance, to avoid zero values. So the minimum value of the variance is equal to minval.

The function lik_garch() calculates the log-likelihood assuming a normal distribution of returns conditional on the variance \sigma^2_{i-1} in the previous period, as follows:

likelihood = - \sum_{i=1}^n (\frac{r^2_i}{\sigma^2_{i-1}} + \log(\sigma^2_{i-1}))

Value

The log-likelihood value.

Examples

## Not run: 
# Define the GARCH model parameters
alpha <- 0.79
betav <- 0.2
om_ega <- 1e-4*(1-alpha-betav)
# Calculate historical VTI returns
retp <- na.omit(rutils::etfenv$returns$VTI)
# Calculate the log-likelihood of VTI returns assuming GARCH(1,1)
HighFreq::lik_garch(omega=om_ega, alpha=alpha,  beta=betav, returns=retp)

## End(Not run)


algoquant/HighFreq documentation built on Feb. 9, 2024, 8:15 p.m.