monte carlo simulation basics

For questions regarding programming in the EViews programming language.

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

tarox
Posts: 24
Joined: Thu Aug 28, 2014 6:46 pm

monte carlo simulation basics

Postby tarox » Mon Oct 20, 2014 1:09 pm

hello everyone

my research is about evaluating mutual funds,, i use two kind of mutual funds ,, i want to use monte carlo simulation for risk ,, and i don't have any i idea about it ,,,i need help in steps or if any one could guide me to books or anything can help with it ,,, i am using Eviews 7

thank you ,,, and i will appreciate your help

CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

Re: monte carlo simulation basics

Postby CharlieEVIEWS » Mon Oct 20, 2014 1:58 pm

I recall thinking that this was an extremely simple exposition:

https://ideas.repec.org/c/ega/comcod/201101.html

And there are other threads on the forum:

http://forums.eviews.com/viewtopic.php?f=5&t=2192

I thought startz had a nice minimal working example which he had posted, but I must have been wrong/or I just can't find it now.

tarox
Posts: 24
Joined: Thu Aug 28, 2014 6:46 pm

Re: monte carlo simulation basics

Postby tarox » Mon Oct 20, 2014 3:17 pm

Thank you charlie for your helpful files .I really appreciate your help ....but the problem is I don't now anything about simulation or where should I start !? Do you know any guide books or websites for beginner users

Thank you

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

Re: monte carlo simulation basics

Postby startz » Mon Oct 20, 2014 3:31 pm


CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

Re: monte carlo simulation basics

Postby CharlieEVIEWS » Mon Oct 20, 2014 3:41 pm

This is exactly what I was thinking of: I knew I had seen it somewhere!

tarox
Posts: 24
Joined: Thu Aug 28, 2014 6:46 pm

Re: monte carlo simulation basics

Postby tarox » Tue Oct 21, 2014 1:53 am

great thanks .... how could i know more about simulation ? and for what we use it? is it for forecasting the risk?

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: monte carlo simulation basics

Postby trubador » Wed Oct 22, 2014 3:16 am

In overly simplistic terms, you can think of simulation as the computer generation of artificial data, which can be used for many many purposes. Of course, Risk Management is (and should be) intensely involved in the subject, but it is not restricted to this field only. Professor Carol Alexander's four volume textbook on Market Risk Analysis might be helpful in this regard: http://www.carolalexander.org/mra.html

I am sure you have already did a Google search on the subject and read through the materials like this one:
http://en.wikipedia.org/wiki/Monte_Carlo_method

Below is the EViews code of Monte Carlo experiment to approximate the value of Pi:

Code: Select all

!nobs = 30000 'number of observations wfcreate u !nobs 'open a workfile series x0 = @rnd 'x-axis of the circle series y0 = @sqrt(1-x0^2) 'y-axis of the circle series y1 'blank series to hold the random numbers to be generated group gr.add x0 y1 y0 'group all the series graph chart.scat gr 'draw a scatter plot chart.setelem(1) symsize(1) 'use small symbol size for y1 chart.setupdate(m) 'manually update the chart show chart 'Monte carlo simulation of Pi value mode quiet !count = 0 for !i=1 to !nobs y1(!i) = @rnd x0(!i) = @rnd y0(!i) = @sqrt(1-x0(!i)^2) if y1(!i)^2 + x0(!i)^2 <=1 then !count = !count+1 'count the number of points inside the circle endif if @mod(!i,1000)=0 then chart.update 'update the chart every other 1000 simulated points endif statusline !i of !nobs next 'calculate the pi value scalar pi = 4*!count/!nobs
Last edited by trubador on Tue Nov 04, 2014 5:20 am, edited 1 time in total.

tarox
Posts: 24
Joined: Thu Aug 28, 2014 6:46 pm

Re: monte carlo simulation basics

Postby tarox » Wed Oct 22, 2014 12:36 pm

oh thank you very much Trubador really helpful and that what i need,,,

so that code could i use it for my data or should i make new code suite my data ,,, i mean i have two kind of mutual funds and two kind of indexes by use 139 observations i want to calculate the Value at risk by using Monte carlo simulation to see which better, so how could apply it? how could i use simulation with it? and the four volume textbook for Professor Carol Alexander would help me ?

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: monte carlo simulation basics

Postby trubador » Wed Oct 22, 2014 11:58 pm

No, you cannot use the code for such purposes. It only demonstrates one of the many uses of monte carlo simulation.
I also suggest the chapters 9,10,11,14 and15 of http://eu.wiley.com/WileyCDA/WileyTitle ... 69039.html
All of these sources will be helpful.

tarox
Posts: 24
Joined: Thu Aug 28, 2014 6:46 pm

Re: monte carlo simulation basics

Postby tarox » Thu Oct 23, 2014 3:30 am

thank you trubador i really appreciate your help ,,,

i just have one more question :? is there any book show the technique or steps for how to apply simulation and value at risk on eviews ?

thank you

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: monte carlo simulation basics

Postby trubador » Thu Oct 23, 2014 5:49 am

I cannot recall such a specific book at the moment, but Carol Alexander's books include EViews examples. You do not have to worry about the EViews implementation, since most of the models are very easy (if not the easiest) to carry out in EViews. You'd better off focusing on the theory and getting familiar with the relevant concepts.

tarox
Posts: 24
Joined: Thu Aug 28, 2014 6:46 pm

Re: monte carlo simulation basics

Postby tarox » Thu Oct 23, 2014 11:30 am

thank you all for your help ,,,i really appreciate your support :wink:

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

Re: monte carlo simulation basics

Postby startz » Thu Oct 23, 2014 3:07 pm

You might want to look at Foundations and Trends in Econometrics, Vol 5
Monte Carlo Simulation for Econometricians
by Jan F. Kiviet

tarox
Posts: 24
Joined: Thu Aug 28, 2014 6:46 pm

Re: monte carlo simulation basics

Postby tarox » Sat Oct 25, 2014 8:14 am

thank you startz ,,, :)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests