Mc Simulation with ML crashes Eviews

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

petfol
Posts: 7
Joined: Wed Jun 17, 2009 1:56 am

Mc Simulation with ML crashes Eviews

Postby petfol » Wed Jun 17, 2009 2:30 am

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 407 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 7405 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.

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Mc Simulation with ML crashes Eviews

Postby startz » Wed Jun 17, 2009 7:31 am

What's the version and build date of your copy of EViews? (See Help/About)

petfol
Posts: 7
Joined: Wed Jun 17, 2009 1:56 am

Re: Mc Simulation with ML crashes Eviews

Postby petfol » Wed Jun 17, 2009 7:43 am

Eviews 6 - Standard Edition - Jun 16 2009 Build

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Mc Simulation with ML crashes Eviews

Postby startz » Wed Jun 17, 2009 7:59 am

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.)

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

Re: Mc Simulation with ML crashes Eviews

Postby EViews Gareth » Wed Jun 17, 2009 8:07 am

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.
Follow us on Twitter @IHSEViews

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

Re: Mc Simulation with ML crashes Eviews

Postby EViews Gareth » Wed Jun 17, 2009 9:13 am

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
Follow us on Twitter @IHSEViews

petfol
Posts: 7
Joined: Wed Jun 17, 2009 1:56 am

Re: Mc Simulation with ML crashes Eviews

Postby petfol » Wed Jun 17, 2009 1:37 pm

Thanks, now it does not crash anymore.


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 10 guests