Speeding up simulations

For questions regarding programming in the EViews programming language.

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

Kavorka
Posts: 47
Joined: Mon Nov 30, 2009 6:06 am

Speeding up simulations

Postby Kavorka » Thu Nov 22, 2018 9:33 am

Please provide some advice on how to avoid loss of speed in Monte Carlo (MC) simulations. I have 4 cores on the computer. Obviously, I choose "Quiet" and not "Verbose update of screen...".

1. If I have to run 4 different MC simulations, is it faster if I run them in a sequence one-by-one, or if I run them all 4 simultaneously (moreover, does it matter if the programs are running in the same "window", or if I open the EViews program icon 4 times and open a program for each)?

2. Is it possible to talk about a trade-off between processor power vs. RAM, in terms of simulations (or does this depend on the type of MC simulations)? Is it possible to provide any guidelines?

Thanks!

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

Re: Speeding up simulations

Postby startz » Thu Nov 22, 2018 10:02 am

Be sure that under general options/advanced you have Compile to machine code on and multiprocessor use set to auto. But you probably do because these are the defaults.

More RAM probably doesn't matter so long as you have enough to contain everything in memory. Unless you are doing a problem with an enormous amount of data or an enormous number of simulations, you probably have enough RAM.

Processor power and the number of cores is mostly what matters. Sometimes code can be rewritten to be much faster, but that's very situation dependent.

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: Speeding up simulations

Postby EViews Matt » Mon Nov 26, 2018 10:40 am

Hello,

In addition to startz's recommendations, you can also perform a simple experiment to determine whether running simulations in parallel would provide any performance benefit. Run one of the simulations and observe the CPU usage. If the usage is 50%-100%, then EViews is already using multiple cores to execute your program and running multiple simulations simultaneously is unlikely to provide any performance gain. On the other hand, if the CPU usage is lower, probably 12.5%-25%, then simultaneous execution has the potential to reduce total run time.

Kavorka
Posts: 47
Joined: Mon Nov 30, 2009 6:06 am

Re: Speeding up simulations

Postby Kavorka » Wed Nov 28, 2018 10:15 pm

Thanks for good advice

Kavorka
Posts: 47
Joined: Mon Nov 30, 2009 6:06 am

Re: Speeding up simulations

Postby Kavorka » Fri Nov 30, 2018 2:38 pm

Thanks for previous answers, but only one more thing. Is it possible to call routines from R in size/power Monte Carlo simulations - or will this be too slow to work in practice (especially regarding panel-data simulations)? I know that this R integration works for empirical data https://www.youtube.com/watch?v=JMLrlZoopas but is it fast enough for simulations? Impossible question to answer, but just give me some hints.

I really appreciate EViews' integration to R. Combining EViews' user-friendliness with the flexibility and the infinite number of canned routines in R is a winner. EViews is much better for teaching than Stata (in my mind) and has a better documentation with links to the relevant seminal research articles. However, since there are more external third-party canned routines for Stata (often published in the Stata Journal), most people in my field chose Stata. Most say that we should switch the teaching to only use Stata, but I argue that all softwares have their pros and cons, and that we teach theory in statistics/econometrics and not softwares (Limdep, SAS, SPSS, EViews, Stata, Minitab, R, Gauss, Gretl, Matlab etc, they all have their pros and cons). However, the main argument is that when writing their master theses and PhD theses many choose Stata since there are a lot of ado files. Therefore (even if you, of course, understand your market better than I do) a strategical investment would be to see the benefit of linking EViews to R.

However, what I would like to use for my students (and for me) is only one demonstration with a panel-data example in EViews where one call any panel-data package in R based on a panel wf1-file. Just to jump-start this since most of us are lazy, and then the integrated EVIews/R community may evolve over time.

User-friendliness is EViews' niche in the market, but when combining this to all packages in R, then there is no need to use any other software in 99% of the cases.

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

Re: Speeding up simulations

Postby EViews Gareth » Fri Nov 30, 2018 3:59 pm

Nicely put thoughts, and you mimic most of our feelings on the subject.

To your specific question...

The slow part of working with R is always going to be the data transferal (although it really isn't that slow at all). Without knowing the specifics of your task, I would have thought in general it would be the case in most Monte Carlo simulations that you would transfer one set of data at the start, run all the simulations in R (without transferring data during each simulation), then transfer the results back. In which case it would be almost as fast (fractions of a second difference) than running it all entirely in R.

Of course it remains to be seen whether the simulations themselves would be faster in R or EViews.
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 30 guests