### GARCH- rolling regressions

Posted:

**Sun Apr 26, 2015 10:35 am**Hi Gareth

I am trying to run a positive feedback trading model in Eviews 8. Firstly, I run the GARCH M code as follows:

sample s0 @first @first+1

sample s1 @first+2 @last

smpl @all

' declare coef vectors to use in ARCH likelihood

coef(4) beta = 0

coef(3) alpha = 0

coef(1) dof = 0

coef(1) mu = 0

' get starting values

equation eq1.arch(1,1,ged,archm=VAR,backcast=1) y c y(-1)

eq1.makegarch garchm

equation eq1.arch(1,1,ged,archm=VAR,backcast=1) y c garchm*y(-1) y(-1)

beta(1) = eq1.c(1)

beta(2) = eq1.c(2)

beta(3) = eq1.c(3)

beta(4) = eq1.c(4)

alpha(1) = eq1.c(5)

alpha(2) = eq1.c(6)

alpha(3) = eq1.c(7)

dof(1) = eq1.c(8)

mu(1) = eq1.@se^2

' set presample values of expressions in logl

series sig2 = mu(1)

series res = resid

' set up GARCH likelihood

logl ll1

ll1.append @logl logl

ll1.append @byeqn

ll1.append res = y - beta(2) - beta(1)*sig2 - beta(3)*sig2*y(-1)- beta(4)*y(-1)

ll1.append sig2 = alpha(1)+ alpha(2)*res(-1)^2 + alpha(3)*sig2(-1)

ll1.append z = res/@sqrt(sig2)

ll1.append logl = log(@dged(z,dof(1))) - log(sig2)/2

' estimate and display results

smpl s1

ll1.ml(showopts, m=1000, c=1e-5)

show ll1.output

I then estimate the T-GARCH model using the following code:

' declare coef vectors to use in ARCH likelihood

coef(4) beta = 0

coef(3) alpha = 0

coef(1) dof = 0

coef(1) mu = 0

coef(1) thresh = 0

' get starting values

eq1.arch(1,1,thrsh=1,archm=VAR,ged,backcast=1) y c y(-1)

eq1.makegarch garchm

eq1.arch(1,1,thrsh=1,archm=VAR,ged,backcast=1) y c garchm*y(-1) y(-1)

beta(1) = eq1.c(1)

beta(2) = eq1.c(2)

beta(3) = eq1.c(3)

beta(4) = eq1.c(4)

alpha(1) = eq1.c(5)

alpha(2) = eq1.c(6)

thresh(1) = eq1.c(7)

alpha(3) = eq1.c(8)

dof(1) = eq1.c(9)

mu(1) = eq1.@se^2

' set presample values of expressions in logl

series sig2 = mu(1)

series res = resid

' set up GARCH likelihood

logl ll1

ll1.append @logl logl

ll1.append @byeqn

ll1.append res = y - beta(2) - beta(1)*sig2 - beta(3)*sig2*y(-1)- beta(4)*y(-1)

ll1.append sig2 = alpha(1)+ alpha(2)*res(-1)^2 + alpha(3)*sig2(-1) + thresh(1)*res(-1)^2*(res(-1)<0)

ll1.append z = res/@sqrt(sig2)

ll1.append logl = log(@dged(z,dof(1))) - log(sig2)/2

' estimate and display results

smpl s1

ll1.ml(showopts, m=1000, c=1e-5)

show ll1.output

My problem is I want to estimate rolling regressions using daily data. I simultaneously estimate the mean and conditional variance for each individual share, every month end during the period 2004-2010. These estimations are done each month using the daily returns for the past six months, on a rolling basis. For example, for the month of July 2004, I will use the daily returns for January 2004 - June 2004. I have tried to fiddle with the basic rolling regressions code that was provided on this site but I am failing to code it correctly. May you please help me on how I can go about it in programming the correct code. I have also attached the daily returns work file that I am using.

Thank you

I am trying to run a positive feedback trading model in Eviews 8. Firstly, I run the GARCH M code as follows:

sample s0 @first @first+1

sample s1 @first+2 @last

smpl @all

' declare coef vectors to use in ARCH likelihood

coef(4) beta = 0

coef(3) alpha = 0

coef(1) dof = 0

coef(1) mu = 0

' get starting values

equation eq1.arch(1,1,ged,archm=VAR,backcast=1) y c y(-1)

eq1.makegarch garchm

equation eq1.arch(1,1,ged,archm=VAR,backcast=1) y c garchm*y(-1) y(-1)

beta(1) = eq1.c(1)

beta(2) = eq1.c(2)

beta(3) = eq1.c(3)

beta(4) = eq1.c(4)

alpha(1) = eq1.c(5)

alpha(2) = eq1.c(6)

alpha(3) = eq1.c(7)

dof(1) = eq1.c(8)

mu(1) = eq1.@se^2

' set presample values of expressions in logl

series sig2 = mu(1)

series res = resid

' set up GARCH likelihood

logl ll1

ll1.append @logl logl

ll1.append @byeqn

ll1.append res = y - beta(2) - beta(1)*sig2 - beta(3)*sig2*y(-1)- beta(4)*y(-1)

ll1.append sig2 = alpha(1)+ alpha(2)*res(-1)^2 + alpha(3)*sig2(-1)

ll1.append z = res/@sqrt(sig2)

ll1.append logl = log(@dged(z,dof(1))) - log(sig2)/2

' estimate and display results

smpl s1

ll1.ml(showopts, m=1000, c=1e-5)

show ll1.output

I then estimate the T-GARCH model using the following code:

' declare coef vectors to use in ARCH likelihood

coef(4) beta = 0

coef(3) alpha = 0

coef(1) dof = 0

coef(1) mu = 0

coef(1) thresh = 0

' get starting values

eq1.arch(1,1,thrsh=1,archm=VAR,ged,backcast=1) y c y(-1)

eq1.makegarch garchm

eq1.arch(1,1,thrsh=1,archm=VAR,ged,backcast=1) y c garchm*y(-1) y(-1)

beta(1) = eq1.c(1)

beta(2) = eq1.c(2)

beta(3) = eq1.c(3)

beta(4) = eq1.c(4)

alpha(1) = eq1.c(5)

alpha(2) = eq1.c(6)

thresh(1) = eq1.c(7)

alpha(3) = eq1.c(8)

dof(1) = eq1.c(9)

mu(1) = eq1.@se^2

' set presample values of expressions in logl

series sig2 = mu(1)

series res = resid

' set up GARCH likelihood

logl ll1

ll1.append @logl logl

ll1.append @byeqn

ll1.append res = y - beta(2) - beta(1)*sig2 - beta(3)*sig2*y(-1)- beta(4)*y(-1)

ll1.append sig2 = alpha(1)+ alpha(2)*res(-1)^2 + alpha(3)*sig2(-1) + thresh(1)*res(-1)^2*(res(-1)<0)

ll1.append z = res/@sqrt(sig2)

ll1.append logl = log(@dged(z,dof(1))) - log(sig2)/2

' estimate and display results

smpl s1

ll1.ml(showopts, m=1000, c=1e-5)

show ll1.output

My problem is I want to estimate rolling regressions using daily data. I simultaneously estimate the mean and conditional variance for each individual share, every month end during the period 2004-2010. These estimations are done each month using the daily returns for the past six months, on a rolling basis. For example, for the month of July 2004, I will use the daily returns for January 2004 - June 2004. I have tried to fiddle with the basic rolling regressions code that was provided on this site but I am failing to code it correctly. May you please help me on how I can go about it in programming the correct code. I have also attached the daily returns work file that I am using.

Thank you