Hello,
I could not decide whether this problem should be posted here, or rather in the bugs section.
I would like to write a MC Simulation with truncated normal dsitribution (code attached)
I experienced two problems:
1. If I run the code it stops very quickly, produces some very strange new series in the dataset, and whatever I do (opening or closing anything), Eviews crashes. This problem remains even if I modify the code, by simplifying it into a simple normal distribution. See picture: . Now, even if I do something incorrectly, this is not the expected reaction by the software. Also, I updated Eviews, and even reinstalle dit, it did not solve the problem.
2. I simulate truncation with a conditional sample choice (smpl if h>160), previously I used a for loop to create a truncated variable, nevertheless, because of the missing values I had to adjust sample anyway, so I decided to drop that part of the code. In both cases, the code (when it did not crash yet), stopped after roughly 5-10 repetitions because of some NA found. I really do not know what is wrong.
Thanks in advance for your help.
Best regards,
Péter
p.s.: I use Vista 32 bit, I hope that is not the root of the problem.
Mc Simulation with ML crashes Eviews
Moderators: EViews Gareth, EViews Moderator
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Mc Simulation with ML crashes Eviews
What's the version and build date of your copy of EViews? (See Help/About)
Re: Mc Simulation with ML crashes Eviews
Eviews 6 - Standard Edition - Jun 16 2009 Build
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Mc Simulation with ML crashes Eviews
petfol wrote:Eviews 6 - Standard Edition - Jun 16 2009 Build
Well that's about as up-to-date as you can get
(I'm afraid a more helpful answer will have to wait for the QMS folks later in the morning.)
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Mc Simulation with ML crashes Eviews
Fascinating bug. I'm going to move this to the bug forum.
We'll get it fixed and post a patch as soon as possible.
We'll get it fixed and post a patch as soon as possible.
Follow us on Twitter @IHSEViews
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Mc Simulation with ML crashes Eviews
The bug is being caused by your lines:
Obviously EViews shouldn't crash, and we'll fix the bug so that EViews doesn't crash, but it will still mean that the LogL won't estimate properly. I believe with those lines you're trying to set starting values for the two coefficients. If that is true, you should set them outside of the LogL, and not inside (since inside it will try to add them as part of the optimisation process).
Thus, this is probably what you want:
Code: Select all
trunc.append c(1)=@mean(h)
trunc.append c(2)=@stdev(h)
Obviously EViews shouldn't crash, and we'll fix the bug so that EViews doesn't crash, but it will still mean that the LogL won't estimate properly. I believe with those lines you're trying to set starting values for the two coefficients. If that is true, you should set them outside of the LogL, and not inside (since inside it will try to add them as part of the optimisation process).
Thus, this is probably what you want:
Code: Select all
wfcreate(wf=truncation) u 1000
table(100,3) results
results(1,1)="experiment"
results(1,2)="mean"
results(1,3)="stddev"
results(1,4)="truncation at"
for !j=1 to 100
series h=170+nrnd*6
smpl if h>160
c(1)=@mean(h)
c(2)=@stdev(h)
logl trunc
trunc.append @logl lltrunc
trunc.append @byeqn
trunc.append lltrunc=log(@dnorm((h-c(1))/c(2)))-log(c(2))-log(@cnorm((h-160)/c(2)))
trunc.ml
results(!j+1,1)=!j
results(!j+1,2)=trunc.@coefs(1)
results(!j+1,3)=trunc.@coefs(2)
next
Follow us on Twitter @IHSEViews
Re: Mc Simulation with ML crashes Eviews
Thanks, now it does not crash anymore.
Who is online
Users browsing this forum: No registered users and 17 guests