Page 1 of 1

Monte Carlo simulation

Posted: Wed Nov 03, 2010 10:00 am
by Ginou
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

Re: Monte Carlo simulation

Posted: Wed Nov 03, 2010 10:17 am
by EViews Gareth
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