Page 1 of 1

Vector and MonteCarlo Simulation

Posted: Mon Sep 29, 2014 9:45 pm
by ecofine
I am running following program from a book.
Can you kindly suggest me how to run and solve this problem?
------------------------------------------
workfile monte u100
!series=5
! draws=100
vector(!draws)montevec=0
--- I had an error message in this place/ !draws is not defined.

for !n=1 to !draws --- this also has some problem.
smpl 1 !series
series x=2+2*nrd
series y=x^2
montevec(!n)=@mean(x)/@mean(y)

next

series momentser=0
mtos(montevec, momentser)
----------------------------------------------

thank you very much!

Re: Vector and MonteCarlo Simulation

Posted: Mon Sep 29, 2014 10:16 pm
by terrya
You appear to have a space between ! and draws in line 3. this makes !draws undefined.

Re: Vector and MonteCarlo Simulation

Posted: Mon Sep 29, 2014 10:47 pm
by EViews Gareth

Code: Select all

! draws=100
should be

Code: Select all

!draws=100

Re: Vector and MonteCarlo Simulation

Posted: Tue Sep 30, 2014 10:05 pm
by ecofine
Thank you for your comment. But it doesn't work. !draws=100, but when I typed
vector(!draws)montvevec=0, it says still undefined. Can you correct me what I was wrong?

Thank you very much!

Re: Vector and MonteCarlo Simulation

Posted: Tue Sep 30, 2014 10:22 pm
by EViews Gareth
Are you running in a program?

Re: Vector and MonteCarlo Simulation

Posted: Wed Oct 01, 2014 5:04 pm
by ecofine
I'm just running the program at the command space of Eviews.

Did you run my program and find no problem? Can you show your results/ Or, I might did a wrong way. I am not good at programming.

Re: Vector and MonteCarlo Simulation

Posted: Wed Oct 01, 2014 9:33 pm
by EViews Gareth
You need to run as a program, not a series of commands.

Re: Vector and MonteCarlo Simulation

Posted: Wed Oct 01, 2014 9:52 pm
by ecofine
I will try and let you know. Thank you!

Re: Vector and MonteCarlo Simulation

Posted: Wed Oct 01, 2014 10:02 pm
by ecofine
It worked very good! Thank you very much! By the way, do I need to always run a program by using batch mode?

Re: Vector and MonteCarlo Simulation

Posted: Thu Oct 02, 2014 7:22 am
by EViews Gareth
Yes