To quantify uncertainty, variance must be evaluated
In financial econometrics, applications include
Mean is difficult to predict
d0 <- read.csv("SPX.csv", header = TRUE)d0$datevec <- as.Date(d0$datevec, format = "%d/%m/%Y")d0$r <- c(NA, diff(log(d0$SP500)) )d0 <- d0[-1,]d1 <- d0[d0$datevec > "2015-01-01", ]plot(y = d1$r, x = d1$datevec, xlim = as.Date( c("2015-01-01", "2017-01-01") ), type = "l")
Square of returns
Dynamic patterns
Volatility clustering
plot( y = d1$r^2, x = d1$datevec, xlim = as.Date( c("2015-01-01", "2017-01-01") ), type = "l")abline(h = mean(d1$r^2), col = "blue", lty = 2)abline(h = 0, col = "red", lty = 2)
plot( y = d1$r^2, x = d1$datevec, ylim = c(0, 2*mean(d1$r^2)), xlim = as.Date( c("2016-01-01", "2017-01-01") ), type = "l")abline(h = mean(d1$r^2), col = "blue", lty = 2)
arima(d1$r, order = c(1,0,0))
## ## Call:## arima(x = d1$r, order = c(1, 0, 0))## ## Coefficients:## ar1 intercept## -0.0094 3e-04## s.e. 0.0416 4e-04## ## sigma^2 estimated as 7.27e-05: log likelihood = 1927.09, aic = -3848.18
arima(d1$r^2, order = c(1,0,0))
## ## Call:## arima(x = d1$r^2, order = c(1, 0, 0))## ## Coefficients:## ar1 intercept## 0.3058 1e-04## s.e. 0.0396 0e+00## ## sigma^2 estimated as 2.257e-08: log likelihood = 4253.34, aic = -8500.68
A time series (yt) is called
rt=√htϵt,
where
ht=Et−1[r2t] is the conditional variance
Suppose ht is adaptive to past information up to (t−1). In other words, Et−1[ht]=ht
N = 100e = rnorm(N)h = 0.5 + 0.5 * c(0,e)^2 # at a `0` to the head of `e` to reflect `lag`h = h[-1] plot(h, type = "l", main = "conditional variance")abline(h = 0.5, col = "red")
r <- h * rnorm(N)plot(r, type = "l", main = "the series of returns")abline(h = 0, col = "red")
Et−1[r2t]=Et−1[htϵ2t]=htEt−1[ϵ2t]=ht×1=ht
E[r2t]=E[Et−1[r2t]]=E[ht]
E[rtrt−k]=E[√htht−kϵtϵt−k]=E[Et−1[√htht−kϵtϵt−k]]=E[√htht−kϵt−kEt−1[ϵt]]=E[√htht−kϵt−k×0]=0
$$ ht = \frac{1}{M} \sum{i=1}^M r_{t-i}^2 $$
$$ ht = (1-\lambda) \sum{j=0}^{\infty} \lambda^i r_{t-i-1}^2 $$
Autoregressive conditional heteroskedastic model (Engle, 1982)
ARCH(q): Models ht as autoregressive on past (rt,rt−1,…,rt−q)
$$ ht = \alpha_0 + \sum{i=1}^q \alphai r{t-i}^2 $$
ht=α0+q∑i=1αir2t−i+p∑i=1βiht−i
$$ ht = \alpha_0 + \alpha_1 r{t-1}^2 + \beta1 h{t-1} $$
is the leading model in practice
ht=α0+α1r2t−1=α0+α1(r2t−1−Et−2[r2t−1])+α1Et−2[r2t−1]=α0+α1(r2t−1−ht−1)+α1ht−1
ht=α0+α1r2t−1+β1ht=α0+α1(r2t−1−ht−1)+(α1+β1)ht−1=α0+α1(r2t−1−ht−1)+ht−1
ht|t−2=Et−2[α0+α1(r2t−1−ht−1)+ht−1]=α0+0+ht−1=α0+ht−1
Integrated-GARCH (IGARCH)
Empirically, ˆα1+ˆβ1 is often close to 1
Regressors can be added to better fit the mean and the variance
Return rμ,x,t=μ0+∑Kk=1γkxkt+ut
Variance ht=α0+∑qi=1αir2t−i+∑pi=1βiht−i+∑Kk=1ψkxkt
Distribution rt∼N(0,ht)
Specification: rt|past history∼N(0,ht)
Observed time series (rμ,t)Tt=1, where we allow an unknown mean in rμ,t=μ0+rt
$$ f(r{\mu, t} | r{\mu, t-1}, r{\mu, t-2},\ldots;\theta) = \frac{1}{\sqrt{2\pi h_t}} \exp\left(-\frac{(r{\mu, t}-\mu)^2}{2h_t}\right) $$
ℓt(θ)=logf(rμ,t|rμ,t−1,rμ,t−2,…;θ)=−12log2π−12loght−(rt−μ)22ht
where ht=α0+∑qi=1αir2t−i+∑pi=1βiht−i
$$ \max{\theta} \sum{t=1}^T \log \ell_t(\theta) $$
fGarch
gar <- garchFit(formula = ~ garch(1,1), data = d1$r, cond.dist = c("norm"))
## ## Series Initialization:## ARMA Model: arma## Formula Mean: ~ arma(0, 0)## GARCH Model: garch## Formula Variance: ~ garch(1, 1)## ARMA Order: 0 0## Max ARMA Order: 0## GARCH Order: 1 1## Max GARCH Order: 1## Maximum Order: 1## Conditional Dist: norm## h.start: 2## llh.start: 1## Length of Series: 576## Recursion Init: mci## Series Scale: 0.008534223## ## Parameter Initialization:## Initial Parameters: $params## Limits of Transformations: $U, $V## Which Parameters are Fixed? $includes## Parameter Matrix:## U V params includes## mu -0.29301831 0.2930183 0.02930183 TRUE## omega 0.00000100 100.0000000 0.10000000 TRUE## alpha1 0.00000001 1.0000000 0.10000000 TRUE## gamma1 -0.99999999 1.0000000 0.10000000 FALSE## beta1 0.00000001 1.0000000 0.80000000 TRUE## delta 0.00000000 2.0000000 2.00000000 FALSE## skew 0.10000000 10.0000000 1.00000000 FALSE## shape 1.00000000 10.0000000 4.00000000 FALSE## Index List of Parameters to be Optimized:## mu omega alpha1 beta1 ## 1 2 3 5 ## Persistence: 0.9 ## ## ## --- START OF TRACE ---## Selected Algorithm: nlminb ## ## R coded nlminb Solver: ## ## 0: 762.16113: 0.0293018 0.100000 0.100000 0.800000## 1: 759.57018: 0.0293031 0.0788547 0.0992305 0.785324## 2: 756.70937: 0.0293060 0.0786691 0.124553 0.789998## 3: 756.63443: 0.0293121 0.0591280 0.137720 0.779615## 4: 755.45163: 0.0293156 0.0694988 0.144753 0.782574## 5: 755.11502: 0.0293278 0.0716495 0.148522 0.770459## 6: 754.84923: 0.0293825 0.0771521 0.169095 0.756102## 7: 754.65299: 0.0297599 0.0937332 0.181315 0.710690## 8: 754.46118: 0.0298784 0.0926112 0.187934 0.716471## 9: 754.44556: 0.0299193 0.0883728 0.189186 0.716695## 10: 754.42417: 0.0300197 0.0885991 0.191146 0.719122## 11: 754.41693: 0.0301539 0.0879314 0.191044 0.718804## 12: 754.36809: 0.0323237 0.0912530 0.189018 0.715188## 13: 754.06029: 0.0449843 0.0887579 0.194768 0.717037## 14: 753.90002: 0.0576412 0.0917023 0.200796 0.706803## 15: 753.88511: 0.0604351 0.0891227 0.195525 0.713504## 16: 753.87586: 0.0632386 0.0896136 0.198517 0.710881## 17: 753.87506: 0.0643934 0.0898699 0.199565 0.709794## 18: 753.87506: 0.0643908 0.0898665 0.199589 0.709790## 19: 753.87506: 0.0643904 0.0898671 0.199589 0.709789## ## Final Estimate of the Negative LLH:## LLH: -1989.999 norm LLH: -3.45486 ## mu omega alpha1 beta1 ## 5.495216e-04 6.545287e-06 1.995887e-01 7.097889e-01 ## ## R-optimhess Difference Approximated Hessian Matrix:## mu omega alpha1 beta1## mu -1.307989e+07 -2.443104e+08 5204.893 -11956.368## omega -2.443104e+08 -1.702545e+12 -42924455.368 -76179748.158## alpha1 5.204893e+03 -4.292446e+07 -2516.685 -2876.809## beta1 -1.195637e+04 -7.617975e+07 -2876.809 -4397.969## attr(,"time")## Time difference of 0.01220894 secs## ## --- END OF TRACE ---## ## ## Time to Estimate Parameters:## Time difference of 0.04920602 secs
## Warning: Using formula(x) is deprecated when x is a character vector of length > 1.## Consider formula(paste(x, collapse = " ")) instead.
fGarch
notation:rμ,t=μ+rtht=ω+α1r2t−1+β1ht−1
print(gar)
## ## Title:## GARCH Modelling ## ## Call:## garchFit(formula = ~garch(1, 1), data = d1$r, cond.dist = c("norm")) ## ## Mean and Variance Equation:## data ~ garch(1, 1)## <environment: 0x00000000213c2820>## [data = d1$r]## ## Conditional Distribution:## norm ## ## Coefficient(s):## mu omega alpha1 beta1 ## 5.4952e-04 6.5453e-06 1.9959e-01 7.0979e-01 ## ## Std. Errors:## based on Hessian ## ## Error Analysis:## Estimate Std. Error t value Pr(>|t|) ## mu 5.495e-04 2.801e-04 1.962 0.049789 * ## omega 6.545e-06 1.805e-06 3.627 0.000287 ***## alpha1 1.996e-01 4.478e-02 4.457 8.31e-06 ***## beta1 7.098e-01 5.374e-02 13.208 < 2e-16 ***## ---## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1## ## Log Likelihood:## 1989.999 normalized: 3.45486 ## ## Description:## Wed Jun 08 23:17:27 2022 by user: zhent
$$ ht = \alpha_0 + [\alpha_1 + \lambda \mathbb{I}(r{t-1}>0)] r{t-1}^2 + \beta_1 h{t-1} $$
ht+1=α0+α1r2t+β1ht
hT+1|T=α0+α1r2T+β1hThT+2|T=α0+α1ET[r2T+1]+β1hT+1|T=α0+(α1+β1)hT+1|T⋯hT+k|T=α0+α1ET[r2T+k−1]+β1hT+k−1|T=α0+(α1+β1)hT+k−1|T
In practice, use estimated coefficients to replace α0, α1 and β1
Long-run average variance
$$ \lim{k\to \infty} h{T+k|T} = \frac{\alpha_0}{1-\alpha_1 - \beta_1} $$
$$ r{T+1}(k) = r{T+1} + r{T+2} + \cdots + r{T+k} $$
$$ ET [r^2{T+1}(k)] = h{T+1|T} + h{T+2|T} + \cdots + h_{T+k|T} $$
predict(gar, n.ahead = 5, plot = TRUE, mse = "cond", nx = 20)
## meanForecast meanError standardDeviation lowerInterval upperInterval## 1 0.0005495216 0.005722513 0.005722513 -0.01066640 0.01176544## 2 0.0005495216 0.006027007 0.006027007 -0.01126320 0.01236224## 3 0.0005495216 0.006291125 0.006291125 -0.01178086 0.01287990## 4 0.0005495216 0.006522029 0.006522029 -0.01223342 0.01333246## 5 0.0005495216 0.006725129 0.006725129 -0.01263149 0.01373053
Issue: ht=Et−1[r2t] cannot observed
Solution: Use r2t as a proxy
Compute the forecast metrics such as RMSE, MAE, ...
In addition, motivated from the likelihood estimation, a popular choice of the loss function is called the quasi-likelihood loss
$$ QLIKE = \log \hat{h}t + \frac{(r{\mu, t} - \hat{\mu}) ^2}{\hat{h}_t} $$
Test the unbiasedness of a forecast
Specify a regression form
r2t=δ0+δ1ˆht+et
and test the null H0: δ0=0 and δ1=1
The problem of this approach is its sensitivity to large shocks
Alternative specifications:
|rt|=δ0+δ1√ˆht+etlogr2t=δ0+δ1logˆht+et
Augment CAPM model to take into account the compensation for risk
GARCH-M (GARCH-in-mean) model:
rit−rft=μ0+μ1hωt+μ2(rmt−rft)+utut∼N(0,ht)ht=α0+α1u2t−1+β1ht−1
Risk-return tradeoff is represented by μ1hωt, where the usual choice of ω is 1 or 0.5.
Test: H0 μ1=0
Similar to the extension from AR to VAR
Consider returns of N assets rt=(r1t,r2t,…,rNt)′
rt=Et−1[rt]+utHt=Et−1[utu′t]
Ht is an N×N time-varying conditional heteroskedastic variance-covariance matrix
Examples:
$$ Ht = C C' + A u{t-1} u{t-1}' A' + B H{t-1} B' $$
GARCH(1,1) is BEKK's special case when N=1
Estimation method:
Drawback: when N is large, too many parameters to estimate as C, A and B are N×N matrices
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |