Dear Sir/Madam,
I shall be very much thankful if you could please help me on developing a Monte Carlo Simulation programme code for the attached workfile (BreuschPagan Test). If you could attach a suggested codes in a programme file would be great but at a minimum, codes step by step would also be sufficient. I have tried by referring some comments of the forum and some documents available on the web but it does not work and ask error messages.
I tried the following, but I could not follow; I am a very beginner
ftp://72.167.164.133/Eviews7/Example%20 ... cintro.htm
http://peterfoldvari.com/advtimeseries/lec3.pdf
Deadline falls tomorrow and I shall be grateful and indebted to you if you could help me on above
Kind regards
Lalitha
Monte Carlo Simulation programme code for BreuschPagan Test
Moderators: EViews Gareth, EViews Jason, EViews Moderator

 Posts: 4
 Joined: Wed Aug 02, 2017 2:35 am
Monte Carlo Simulation programme code for BreuschPagan Test
 Attachments

 bp.WF1
 (25.86 KiB) Downloaded 40 times

 Posts: 4
 Joined: Wed Aug 02, 2017 2:35 am
Re: Monte Carlo Simulation programme code for BreuschPagan Test
Dear Friends,
I could got hold of the following but I have a problem
wfcreate dfsimu u 1 10000 'we create the workfile called dfsimu with 10000 observations
series testresults 'this is the variable where we store our testresults for final analysis
scalar fivepercentcrit 'this is where we store our estimate of the 5% critical value
for !i=1 to 10000 'we will repeat this 1000 times
series y=0 ' we create the series y with the starting value 0
smpl 2 101 'no we need to reset the sample to 2101
y=1+y(1)+nrnd ' we generate the random series according our assumptions
equation eq.ls d(y) c y(1) 'we run the test regression on the generated 100 observations
smpl @all 'we reset the sample to the 1 10000
testresults(!i)=eq.@tstats(2) 'save the test stat
fivepercentcrit=@quantile(testresults,.05)
But when I try to run the programme (without those explaining words), the it gives an error message message as;
"For statement exterminated in "FOR iI=1 TO 10000"
How can I fix this issue? and does MC simulation takes actual values from the regression?.
Kind regards
Lalitha
I could got hold of the following but I have a problem
wfcreate dfsimu u 1 10000 'we create the workfile called dfsimu with 10000 observations
series testresults 'this is the variable where we store our testresults for final analysis
scalar fivepercentcrit 'this is where we store our estimate of the 5% critical value
for !i=1 to 10000 'we will repeat this 1000 times
series y=0 ' we create the series y with the starting value 0
smpl 2 101 'no we need to reset the sample to 2101
y=1+y(1)+nrnd ' we generate the random series according our assumptions
equation eq.ls d(y) c y(1) 'we run the test regression on the generated 100 observations
smpl @all 'we reset the sample to the 1 10000
testresults(!i)=eq.@tstats(2) 'save the test stat
fivepercentcrit=@quantile(testresults,.05)
But when I try to run the programme (without those explaining words), the it gives an error message message as;
"For statement exterminated in "FOR iI=1 TO 10000"
How can I fix this issue? and does MC simulation takes actual values from the regression?.
Kind regards
Lalitha
 Attachments

 lec3.pdf
 (499.63 KiB) Downloaded 35 times

 Nonnormality and collinearity are NOT problems!
 Posts: 3299
 Joined: Wed Sep 17, 2008 2:25 pm
Re: Monte Carlo Simulation programme code for BreuschPagan Test
Did you include a next statement?

 Posts: 4
 Joined: Wed Aug 02, 2017 2:35 am
Re: Monte Carlo Simulation programme code for BreuschPagan Test
Dear Friend,
I owe you a lot. Thanks it worked. OMG I can submit my proposal today without delay. Thank you once again.
I can change the equation to OLS now and do it again. If I do that equation would be as follows I guess
I must fist specify the equation
y= c+x+nrnd as a replacement of y=1+y(1)+nrnd ' we generate the random series according our assumptions
then I will specify the test regression for BP test
equation eq.ls d(resid^2) c x as a replacement of equation eq.ls d(y) c y(1) 'we run the test regression on the generated 100 observations
and the rest will be same.
One or thing, If I want to divide resid^2 by number of observation ie 100 (as in this case and I understand I can change it in other trial) and then regress it on x, how could I code it, Can I do it like;
eq.ls d(resid^2)n c x I do not know n is a standard or may I use 100
Kind regards
Lalitha
I owe you a lot. Thanks it worked. OMG I can submit my proposal today without delay. Thank you once again.
I can change the equation to OLS now and do it again. If I do that equation would be as follows I guess
I must fist specify the equation
y= c+x+nrnd as a replacement of y=1+y(1)+nrnd ' we generate the random series according our assumptions
then I will specify the test regression for BP test
equation eq.ls d(resid^2) c x as a replacement of equation eq.ls d(y) c y(1) 'we run the test regression on the generated 100 observations
and the rest will be same.
One or thing, If I want to divide resid^2 by number of observation ie 100 (as in this case and I understand I can change it in other trial) and then regress it on x, how could I code it, Can I do it like;
eq.ls d(resid^2)n c x I do not know n is a standard or may I use 100
Kind regards
Lalitha

 Posts: 4
 Joined: Wed Aug 02, 2017 2:35 am
Re: Monte Carlo Simulation programme code for BreuschPagan Test
lalithaamara76 wrote:Dear Friend,
I owe you a lot. Thanks it worked. OMG I can submit my proposal today without delay. Thank you once again.
I can change the equation to OLS now and do it again. If I do that equation would be as follows I guess
I must fist specify the equation
y= c+x+nrnd as a replacement of y=1+y(1)+nrnd ' we generate the random series according our assumptions
then I will specify the test regression for BP test
equation eq.ls d(resid^2) c x as a replacement of equation eq.ls d(y) c y(1) 'we run the test regression on the generated 100 observations
and the rest will be same.
One or thing, If I want to divide resid^2 by number of observation ie 100 (as in this case and I understand I can change it in other trial) and then regress it on x, how could I code it, Can I do it like;
eq.ls d(resid^2)n c x I do not know n is a standard or may I use 100
Kind regards
Lalitha
I came up with this OLS first
wfcreate dfsimu u 1 10000
series testresults
scalar fivepercentcrit
for !i=1 to 10000
series y=0
series x=rnd
smpl 2 101
y=1+x+nrnd
equation eq.ls y c x
smpl @all
testresults(!i)=eq.@tstats(2)
next
fivepercentcrit=@quantile(testresults,.05)
I did not use d in equation, I think it is alright
then I have taken the saved residuals and generated R using generate window R=resid^2 and then I did the following
wfcreate dfsimu u 1 10000
series testresults
scalar fivepercentcrit
for !i=1 to 10000
series r=0
series x=rnd
smpl 2 101
r=1+x+nrnd
equation eq.ls d c x
smpl @all
testresults(!i)=eq.@tstats(2)
next
fivepercentcrit=@quantile(testresults,.05)
Can I take this is MC test for BP by residuals.
Kindly help experts
Thanks
lalitha
Who is online
Users browsing this forum: Google [Bot] and 1 guest