Page 1 of 1

Possible Bug in Model Simulation

Posted: Thu Oct 13, 2016 8:08 am
by Dennis
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.

Re: Possible Bug in Model Simulation

Posted: Thu Oct 13, 2016 8:23 am
by EViews Gareth
I think you're forgetting to include the innovations in your interpretation of what the bounds should be.

Re: Possible Bug in Model Simulation

Posted: Thu Oct 13, 2016 10:35 am
by Dennis
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.

Re: Possible Bug in Model Simulation

Posted: Thu Oct 13, 2016 10:54 am
by EViews Gareth
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.

Re: Possible Bug in Model Simulation

Posted: Thu Oct 13, 2016 11:27 am
by Dennis
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)

Re: Possible Bug in Model Simulation

Posted: Thu Oct 13, 2016 11:36 am
by EViews Glenn
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.

Re: Possible Bug in Model Simulation

Posted: Thu Oct 13, 2016 11:37 am
by EViews Gareth
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.

Re: Possible Bug in Model Simulation

Posted: Thu Oct 13, 2016 11:49 am
by EViews Gareth
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.

Re: Possible Bug in Model Simulation

Posted: Thu Oct 13, 2016 11:52 am
by EViews Glenn
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)

Re: Possible Bug in Model Simulation

Posted: Thu Oct 13, 2016 1:27 pm
by Dennis
Thank you both. I really appreciate the help!