Possible Bug in Model Simulation

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

Dennis
Posts: 14
Joined: Fri Dec 16, 2011 8:11 am

Possible Bug in Model Simulation

Postby Dennis » Thu Oct 13, 2016 8:08 am

When doing stochastic simulation in a model, I find that the confidence bounds are too wide. Here are two examples:

If I simulate from the uniform distribution using the following:
r1=rnd
I obtain 90% confidence bounds that are outside of the support of the distribution. The simulated bounds are approximately -.32 and 1.32.

If I simulate from the standard normal distribution using
r2=nrnd
I obtain 90% confidence bounds that are too wide, approximately -2.9 and +2.9

I am using Eviews 9. Please advise. Thanks.

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

Re: Possible Bug in Model Simulation

Postby EViews Gareth » Thu Oct 13, 2016 8:23 am

I think you're forgetting to include the innovations in your interpretation of what the bounds should be.
Follow us on Twitter @IHSEViews

Dennis
Posts: 14
Joined: Fri Dec 16, 2011 8:11 am

Re: Possible Bug in Model Simulation

Postby Dennis » Thu Oct 13, 2016 10:35 am

Could you elaborate Gareth. I've read the discussion of simulation in the help file and may not be understanding how the simulation works. I thought the simulation of r1=rnd in a model object would draw 1,000 observations from the [0,1] uniform distribution and then compute the confidence bounds from that simulation. (By the way, if it matters, I'm using Stochastic Static simulation.) Thanks.

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

Re: Possible Bug in Model Simulation

Postby EViews Gareth » Thu Oct 13, 2016 10:54 am

Each equation in the model, unless it is specified as an identity, has an implicit error term on the end. So your line:

Code: Select all

r1 = rnd

is actually:

Code: Select all

r1 = rnd + nrnd


where the stochastic solve is generating the nrnd part.
Follow us on Twitter @IHSEViews

Dennis
Posts: 14
Joined: Fri Dec 16, 2011 8:11 am

Re: Possible Bug in Model Simulation

Postby Dennis » Thu Oct 13, 2016 11:27 am

I understand. Is there a workaround? If I use
@identity r1=rnd
I get an error message: "Matrix or vector given non positive dimension"

It may help if I provide more background. In an earlier post on simulating from a discrete distribution, a contributor named Glenn responded to my post and suggested the following two lines of code to simulate from a discrete distribution. I thought this was an appealing way to proceed but, when I implemented it, I found that this did not produce the correct discrete distribution. I now understand why, but I am not sure how to get around this problem.

z = rnd
@identity w = 8 * (z<.2) + 10 * (z<.3 and z>=.2) + 15 * (z<.55 and z>=.3) + 17 * (z<.72 and z>=.55) + 22 * (z>=.72)

EViews Glenn
EViews Developer
Posts: 2530
Joined: Wed Oct 15, 2008 9:17 am

Re: Possible Bug in Model Simulation

Postby EViews Glenn » Thu Oct 13, 2016 11:36 am

Ah, sorry, it's the extra nrnd at the end of the Z which I didn't think about. Let us think about this for a bit.

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

Re: Possible Bug in Model Simulation

Postby EViews Gareth » Thu Oct 13, 2016 11:37 am

Try using:

Code: Select all

m.stochastic(m=1e-16)


which should multiply the innovation covariance matrix by (essentially) zero, meaning the innovations become tiny.
Follow us on Twitter @IHSEViews

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

Re: Possible Bug in Model Simulation

Postby EViews Gareth » Thu Oct 13, 2016 11:49 am

Glenn pointed out another trick that is slightly better:

Code: Select all

model m
m.append r2=0
m.append @innov r2 1
m.append @identity r1 = @cnorm(r2)
m.solve(s=a)


r2 gets generated with a variance of 1 from the normal. The cnorm of a normal returns a uniform.
Follow us on Twitter @IHSEViews

EViews Glenn
EViews Developer
Posts: 2530
Joined: Wed Oct 15, 2008 9:17 am

Re: Possible Bug in Model Simulation

Postby EViews Glenn » Thu Oct 13, 2016 11:52 am

Note that the R1 in Gareth's snippet gives you the Z from above which you'll feed into the other identity.

Code: Select all

@identity w = 8 * (z<.2) + 10 * (z<.3 and z>=.2) + 15 * (z<.55 and z>=.3) + 17 * (z<.72 and z>=.55) + 22 * (z>=.72)

Dennis
Posts: 14
Joined: Fri Dec 16, 2011 8:11 am

Re: Possible Bug in Model Simulation

Postby Dennis » Thu Oct 13, 2016 1:27 pm

Thank you both. I really appreciate the help!


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest