Page 1 of 1

check code

Posted: Thu Apr 28, 2016 10:04 pm
by Karen8169
‘Create a workfile undated, range 1 to 500.
!reps = 50000
for !i=1 to !reps
genr perturbacion{!i}=@nrnd
smpl 1 1
genr y{!i}=0
smpl 2 500
genr y{!i}=y{!i}(-1)+perturbacion{!i}
smpl 1 500
matrix(!reps,2) resultados
equation eq{!i}.ls D(y{!i})=c(1)*y{!i}(-1)
resultados(!i,1)=eq{!i}.@coefs(1)
resultados(!i,2)=eq{!i}.@tstats(1)
d perturbacion{!i}
d y{!i}
d eq{!i}
NEXT
‘Export “resultados” to Excel.
‘Create a workfile undated, range 1 to 50,000.
‘Copy and paste from Excel to the workfile.

All above are the code that I can paste to the eviews and run a Monte Carlo Experiment: A Dickey-Fuller Distribution.
Is anywhere need to be modified? Thanks a lot.

Re: check code

Posted: Fri Apr 29, 2016 3:26 am
by trubador
If you are not familiar with EViews, I suggest you to learn the basics before doing such complex analyses. Other than that, use the modified code below instead:

Code: Select all

wfcreate u 500 'create an undated workfile with 500 observations. !reps = 10000 'number of simulations matrix(!reps,2) resultados 'create a matrix to store the results series y 'create a blank series equation eq 'create an equation object smpl 2 500 'adjust the sample mode quiet 'run in quiet mode 'run the simulation for !i=1 to !reps y(1)=@nrnd 'randomly initialize the first value y=y(-1)+@nrnd 'generate a random walk sequence eq.ls D(y)=c(1)*y(-1) 'estimate the equation resultados(!i,1)=eq.@coefs(1) 'store the coefficients resultados(!i,2)=eq.@tstats(1) 'store the t-stats statusline !i of !reps 'monitor the progress NEXT delete y eq 'clean up if you like

Re: check code

Posted: Mon May 02, 2016 4:59 am
by Karen8169
Sorry,can I ask you basic equations?
How to define y and eq or where can I get related information? (I never use code on eviews before.)
Where can I see related information on youtube because most of videos just teach us how to click on youtube?
Thanks a million!!!

Re: check code

Posted: Mon May 02, 2016 11:48 pm
by trubador
Open a program window (File->New->Program), copy-and-paste the script and then hit Run. All the information produced will be stored in the workfile.

Re: check code

Posted: Wed May 04, 2016 6:59 am
by Karen8169
Can I ask you a few questions?
1."wfcreate u 500"
I know that "wfcreate u 500" means to create a new workfile called u,with 100 random data, but where is the workfile u when I run the code?

2.matrix(!reps,2) resultado
Why I have to create a matrix? Can it be a series?

3.Why can't I change the arrangement like that? What errors will be made?
series y
y(1)=0
y=y(-1)+nrnd
equation eq
eq.ls D(y)=c(1)*y(-1)
smpl 2 500
mode quiet

4.What the meaning of the arrangement?
series y
equation eq

5.What dose the "statusline" mean?
ThANK YOU!!

Re: check code

Posted: Wed May 04, 2016 7:15 am
by EViews Gareth
1. http://www.eviews.com/help/helpintro.ht ... reate.html

2. It is the wrong size to be a series.

3. Why don't you try it and see.

4. Create a series called Y. Create an equation called EQ

5. http://www.eviews.com/help/helpintro.ht ... sline.html