Page 1 of 1

Mc Simulation with ML crashes Eviews

Posted: Wed Jun 17, 2009 2:30 am
by petfol
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)
truncnormal.prg
(533 Bytes) Downloaded 918 times
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:
crash.jpg
crash.jpg (34.98 KiB) Viewed 9689 times
. 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.

Re: Mc Simulation with ML crashes Eviews

Posted: Wed Jun 17, 2009 7:31 am
by startz
What's the version and build date of your copy of EViews? (See Help/About)

Re: Mc Simulation with ML crashes Eviews

Posted: Wed Jun 17, 2009 7:43 am
by petfol
Eviews 6 - Standard Edition - Jun 16 2009 Build

Re: Mc Simulation with ML crashes Eviews

Posted: Wed Jun 17, 2009 7:59 am
by startz
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.)

Re: Mc Simulation with ML crashes Eviews

Posted: Wed Jun 17, 2009 8:07 am
by EViews Gareth
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.

Re: Mc Simulation with ML crashes Eviews

Posted: Wed Jun 17, 2009 9:13 am
by EViews Gareth
The bug is being caused by your lines:

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

Re: Mc Simulation with ML crashes Eviews

Posted: Wed Jun 17, 2009 1:37 pm
by petfol
Thanks, now it does not crash anymore.