Vector and MonteCarlo Simulation

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

ecofine
Posts: 28
Joined: Fri Sep 26, 2014 2:24 am

Vector and MonteCarlo Simulation

Postby ecofine » Mon Sep 29, 2014 9:45 pm

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!

terrya
Posts: 107
Joined: Wed Aug 26, 2009 2:37 pm

Re: Vector and MonteCarlo Simulation

Postby terrya » Mon Sep 29, 2014 10:16 pm

You appear to have a space between ! and draws in line 3. this makes !draws undefined.

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

Re: Vector and MonteCarlo Simulation

Postby EViews Gareth » Mon Sep 29, 2014 10:47 pm

Code: Select all

! draws=100
should be

Code: Select all

!draws=100

ecofine
Posts: 28
Joined: Fri Sep 26, 2014 2:24 am

Re: Vector and MonteCarlo Simulation

Postby ecofine » Tue Sep 30, 2014 10:05 pm

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!

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

Re: Vector and MonteCarlo Simulation

Postby EViews Gareth » Tue Sep 30, 2014 10:22 pm

Are you running in a program?

ecofine
Posts: 28
Joined: Fri Sep 26, 2014 2:24 am

Re: Vector and MonteCarlo Simulation

Postby ecofine » Wed Oct 01, 2014 5:04 pm

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.

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

Re: Vector and MonteCarlo Simulation

Postby EViews Gareth » Wed Oct 01, 2014 9:33 pm

You need to run as a program, not a series of commands.

ecofine
Posts: 28
Joined: Fri Sep 26, 2014 2:24 am

Re: Vector and MonteCarlo Simulation

Postby ecofine » Wed Oct 01, 2014 9:52 pm

I will try and let you know. Thank you!

ecofine
Posts: 28
Joined: Fri Sep 26, 2014 2:24 am

Re: Vector and MonteCarlo Simulation

Postby ecofine » Wed Oct 01, 2014 10:02 pm

It worked very good! Thank you very much! By the way, do I need to always run a program by using batch mode?

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

Re: Vector and MonteCarlo Simulation

Postby EViews Gareth » Thu Oct 02, 2014 7:22 am

Yes


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests