## simulate arch(1) & arch(2)

For questions regarding programming in the EViews programming language.

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

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

### simulate arch(1) & arch(2)

Hi everyone
I have problem with this two code, i get NA series after the first observation for the 1st code, and i get error message for the second code.
i would highly appreciate if any of you could help me!
1/first code ARCH(1)

Code: Select all

`' program 1 simulation ARCH(1)wfcreate u 1000smpl @all'define series: normal innovation (z),variance (vr), error (e), return (r)series z= nrndseries vrseries eseries r'initialize the series to start the recursion, the vr starts at the unconditional variance value of 4smpl @first @firstvr=4e = @sqrt(vr)*zr= 2+e'start the recursion from 2 to the number of observations you wish to generate we have set omega = 2 and alpha = 0.5smpl @first+1 @lastvr=2+0.5*e^2e = @sqrt(vr)*zr= 2+esmpl @all`

2/ second code

Code: Select all

`' program 2 simulation ARCH(2)wfcreate u 1000smpl @all'define series: normal innovation (z),variance (vr), error (e), return (r)series z= nrndseries vrseries eseries r'initialize the series to start the recursion, the vr starts at the unconditional variance value of 2.5smpl @first @first+1vr(1)=2.5vr(2)=vr(1)e(1) = @sqrt(vr(1))*ze(2)=@sqrt(vr(1))*zr(1)= 2+e(1)r(2)= 2+e(2)'start the recursion from 3 to the number of observations you wish to generate we have set omega = 2 and alpha1 = 0.5, alpha 2= 0.3smpl @first+2 @lastvr=2+0.5*e^2+0.3*e^2e = @sqrt(vr)*zr= 2+esmpl @all`

startz
Non-normality and collinearity are NOT problems!
Posts: 3578
Joined: Wed Sep 17, 2008 2:25 pm

### Re: simulate arch(1) & arch(2)

In the first program you've only defined e for the first observation.

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

### Re: simulate arch(1) & arch(2)

1/Got it! Mr startz, the first code work perfectly now, but the second code after some modification it work but i get NA from the third obs to the last.
Any help. the second code is attached below.
2/another question: if i would like to simulate ARCH(p) should be the variances in the second part of my program be equal (vr1=vr2=vr3...etc) or not?
Attachments
sim_arch(2).prg
simulation ARCH(2)
(617 Bytes) Downloaded 122 times

startz
Non-normality and collinearity are NOT problems!
Posts: 3578
Joined: Wed Sep 17, 2008 2:25 pm

### Re: simulate arch(1) & arch(2)

Only the first two observations for VR are set before you use the whole series.

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

### Re: simulate arch(1) & arch(2)

No idea!, whats wrong with the code

startz
Non-normality and collinearity are NOT problems!
Posts: 3578
Joined: Wed Sep 17, 2008 2:25 pm

### Re: simulate arch(1) & arch(2)

At the bottom of the code you set vr to depend on e. But at that point only two elements of e have been set.

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

### Re: simulate arch(1) & arch(2)

I don't follow you , could you solve this Mr startz.

ecofin
Posts: 182
Joined: Fri May 10, 2013 11:24 am

### Re: simulate arch(1) & arch(2)

Any help please.

Return to “Programming”

### Who is online

Users browsing this forum: No registered users and 11 guests