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.
Possible Bug in Model Simulation
Moderators: EViews Gareth, EViews Moderator

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11283
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Possible Bug in Model Simulation
I think you're forgetting to include the innovations in your interpretation of what the bounds should be.
Follow us on Twitter @IHSEViews
Re: Possible Bug in Model Simulation
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.

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11283
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Possible Bug in Model Simulation
Each equation in the model, unless it is specified as an identity, has an implicit error term on the end. So your line:
is actually:
where the stochastic solve is generating the nrnd part.
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
Re: Possible Bug in Model Simulation
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)
@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 Developer
 Posts: 2530
 Joined: Wed Oct 15, 2008 9:17 am
Re: Possible Bug in Model Simulation
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.

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11283
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Possible Bug in Model Simulation
Try using:
which should multiply the innovation covariance matrix by (essentially) zero, meaning the innovations become tiny.
Code: Select all
m.stochastic(m=1e16)
which should multiply the innovation covariance matrix by (essentially) zero, meaning the innovations become tiny.
Follow us on Twitter @IHSEViews

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11283
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Possible Bug in Model Simulation
Glenn pointed out another trick that is slightly better:
r2 gets generated with a variance of 1 from the normal. The cnorm of a normal returns a uniform.
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 Developer
 Posts: 2530
 Joined: Wed Oct 15, 2008 9:17 am
Re: Possible Bug in Model Simulation
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
Thank you both. I really appreciate the help!
Who is online
Users browsing this forum: No registered users and 1 guest