Monte Carlo simulation

For questions regarding programming in the EViews programming language.

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

Ginou
Posts: 1
Joined: Wed Nov 03, 2010 9:42 am

Monte Carlo simulation

Postby Ginou » Wed Nov 03, 2010 10:00 am

Hi all :

How can we program a Var model estimation based on Monte Carlo simulation ( in other words independant variables are simulated using monte carlo technics)? I would like to use this approach directly in eviews instead of transferring all data on excel and use cristal ball software.

Many Thanks for your help

:wink: Ginou

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

Re: Monte Carlo simulation

Postby EViews Gareth » Wed Nov 03, 2010 10:17 am

A very rough, quick version:

Code: Select all

!t = 100 'workfile size !k = 3 'number of variables !l = 2 'number of lags in VAR !its = 100 'number of repititions. 'make workfile create u !t 'declare VAR object to be used for estimation VAR theVAR 'make string containing names of variables (populated in the loop below) %varlist = "" 'declare vector for storing AIC vector(!its) AICs for !i = 1 to !its 'generate variables for !j = 1 to !k series x!j = nrnd %varlist = %varlist + " X" + @str(!j) next 'estimate VAR theVAR.LS 1 !l {%varlist} 'store current AIC AICS(!i) = theVAR.@aic next 'show AICS show AICS


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests