Model AR(1) - GARCH(1,1) Code

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

malia.mit
Posts: 4
Joined: Wed Jan 13, 2016 8:06 am

Model AR(1) - GARCH(1,1) Code

Postby malia.mit » Wed Jan 13, 2016 8:21 am

Hi !
I'm new on Eviews and I don't know how to program with.
I try to program a model ar(1) garch(1,1), but it doesn't work.
My code is :

Code: Select all

' number of experiments !M = 1000 !N = 132 ' historical period !H = 20 ' forecast period !nn = !n + !h !k =4 'number of coefficients + ar terms 'Paramètre de AR(1) !p1 = 0.38 'constant !B0 = 0 'coeffient for X1 !B1 = 0.07 'coefficient for X2 !B2 = 1.07 Workfile TimeSeries u !nn 'declare objects to be used in simulations equation e1 'run simulations for !sim=1 to !m 'create error term series u = nrnd smpl @first+2 @last series u = !B2*nrnd^2 + !B1*u(-1) 'create y series series y= nrnd smpl @first+2 @last series y =!B1*y(-1) + u(!sim) 'estimate equation 'smpl @first !n 'e1.arch y x1 x2 ar(1) 'make forecast 'smpl !n+1 @last 'e1.forecast yf next
Thanks you for your help :D

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Model AR(1) - GARCH(1,1) Code

Postby EViews Gareth » Wed Jan 13, 2016 8:38 am

What doesn't work?

malia.mit
Posts: 4
Joined: Wed Jan 13, 2016 8:06 am

Re: Model AR(1) - GARCH(1,1) Code

Postby malia.mit » Wed Jan 13, 2016 9:46 am

When I run, the values of Y are : "NA"

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Model AR(1) - GARCH(1,1) Code

Postby EViews Gareth » Wed Jan 13, 2016 9:55 am

Code: Select all

smpl @first @first series y= nrnd smpl @first+1 @last series y =!B1*y(-1) + u
Probably want it like that.

malia.mit
Posts: 4
Joined: Wed Jan 13, 2016 8:06 am

Re: Model AR(1) - GARCH(1,1) Code

Postby malia.mit » Wed Jan 13, 2016 12:30 pm

It's give me the first value of Y, but not the other

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Model AR(1) - GARCH(1,1) Code

Postby EViews Gareth » Wed Jan 13, 2016 12:37 pm

Probably need to set the sample correctly when generating U too.

malia.mit
Posts: 4
Joined: Wed Jan 13, 2016 8:06 am

Re: Model AR(1) - GARCH(1,1) Code

Postby malia.mit » Wed Jan 13, 2016 12:55 pm

The values of U are corrects and generating. I don't understand why it's work with U but not with Y


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests