lik_garch | R Documentation |
Calculate the log-likelihood of a time series of returns assuming a GARCH(1,1) process.
lik_garch(omegac, alphac, betac, returns, minval = 1e-06)
omegac |
Parameter proportional to the long-term average level of variance. |
alphac |
The weight associated with recent realized variance updates. |
betac |
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 |
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}))
The log-likelihood value.
## Not run:
# Define the GARCH model parameters
alphac <- 0.79
betac <- 0.2
omegac <- 1e-4*(1-alphac-betac)
# 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(omegac=omegac, alphac=alphac, betac=betac, returns=retp)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.