Page 1 of 1

Hello I have a question regardinf the variables in m garch bekk codes and the "mu"

Posted: Sat Aug 13, 2016 3:43 pm
by ayca79
Hello, I have a question regarding the mu in those bekk codes. It is used for calculating the errors of the series. The series do not display White noise. I want to estimate the conditional covariances in the out of sample with the parameters in the in-sample. How can I do that? My two series are autoregressive and I used the errors of the returs series as variables in the bekk model.

Do I still need "mu" in order to calculate the residuals? Or what is the function of mu exactly?


I need help for right interpretation.

Below are my codes

smpl @all
series r1 =errorp1
series r2 =errorpm
sample s0 1 2234
sample s1 2 2234
smpl s0
equation eq1.arch(m=100,c=1e-5,h,b) r1 c
equation eq2.arch(m=100,c=1e-5,h,b) r2 c

coef(2) mu
mu(1) = eq1.c(1)
mu(2)= eq2.c(1)

coef(3) omega
omega(1)=0.5
omega(2)=0
omega(3)=0.5

coef(2) alpha
alpha(1)=0.5
alpha(2)=0.5

coef(2) beta
beta(1)=0.5
beta(2)=0.5

!mlog2pi=2*log(2*@acos(-1))

series cov_r1r2=@cov(r1-mu(1),r2-mu(2))
series var_r1=@var(r1)
series var_r2=@var(r2)

series sqres1=(r1-mu(1))^2
series sqres2=(r2-mu(2))^2
series res1res2=(r1-mu(1))*(r2-mu(2))

logl bvgarch
bvgarch.append @logl logl
bvgarch.append sqres1=(r1-mu(1))^2
bvgarch.append sqres2=(r2-mu(2))^2
bvgarch.append res1res2=(r1-mu(1))*(r2-mu(2))


bvgarch.append var_r1=omega(1)^2 + beta(1)^2*var_r1(-1) + alpha(1)^2*sqres1(-1)
bvgarch.append var_r2=omega(3)^2+omega(2)^2 + beta(2)^2*var_r2(-1) + alpha(2)^2*sqres2(-1)
bvgarch.append cov_r1r2=omega(1)*omega(2) + beta(2)*beta(1)*cov_r1r2(-1) + alpha(2)*alpha(1)*res1res2(-1)

bvgarch.append deth=var_r1*var_r2-cov_r1r2^2

bvgarch.append invh1=var_r2/deth
bvgarch.append invh3=var_r1/deth
bvgarch.append invh2=-cov_r1r2/deth

bvgarch.append logl=-0.5*(!mlog2pi+(invh1*sqres1+2*invh2*res1res2+invh3*sqres2)+log(deth))

smpl s1
bvgarch.ml(showopts, m=100, c=1e-5,b)

show bvgarch.output
graphvarcov.line var_r1 var_r2 cov_r1r2
show varcov

scalar lr=-2*(eq1.@logl+eq2.@logl-bvgarch.@logl)
scalar lr_pval=1-cchisq(lr,1)