Monte Carlo of STEPWISE regression

For questions regarding programming in the EViews programming language.

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

chungrak9
Posts: 16
Joined: Sat May 31, 2014 9:09 am

Monte Carlo of STEPWISE regression

Postby chungrak9 » Mon Jun 09, 2014 1:55 pm

Hello.
I’m using EViews 8. I’m a beginner. There are too many challenges that I cannot handle. Please help.

The data file is small and simple. The number of observations is 50. There are six variables: y, x1, x2, x3, x4, and x5.

I’d like to do a Monte Carlo simulation of ‘stepwise OLS regression’ and find the probability of specifying the true model (i.e., y=f(x1, x2, x3)), or the percent of true models among the 1000 repetitions. I’d like to run the simulation on different sample sizes (i.e., n=50 and n=100) and different standard deviations of the stochastic component (sigma=0.7 and sigma=0.4).

Thus, there are four different settings:
(1) equation mc1.stepls y @ x1 x2 x3 x4 x5 0.7*@rnorm ‘ n=50
(2) equation mc2.stepls y @ x1 x2 x3 x4 x5 0.4*@rnorm ‘ n=50
(3) equation mc3.stepls y @ x1 x2 x3 x4 x5 0.7*@rnorm ‘ n=100
(4) equation mc4.stepls y @ x1 x2 x3 x4 x5 0.4*@rnorm ‘ n=100

The first challenge that I’m faced with is sampling. How can I sample 100 observations when there are actually 50 observations in the data?

The second challenge is storing the results. I know how to store some of the statistics (such as @coef(1) or @aic) in vectors or matrices; but what I have to store is the list of variables that are selected so that I can count the number of correct models among the 1000 replications.

Would you please help me? Thank you very much in advance.
Rakkoo

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

Re: Monte Carlo of STEPWISE regression

Postby EViews Gareth » Mon Jun 09, 2014 2:06 pm

I'm going to leave aside the econometric issues of your first question, but state that you can use equation.@varlist to return a list of the final regressors (and the dependent variable, which you can always ignore).
Follow us on Twitter @IHSEViews

chungrak9
Posts: 16
Joined: Sat May 31, 2014 9:09 am

Re: Monte Carlo of STEPWISE regression

Postby chungrak9 » Tue Jun 10, 2014 8:44 am

Thanks a lot! I was able to store the variable list in a svector.

BTW, let me change my first question: Can EViews randomly draw a certain number of observations (or a certain percent) from the data?

In the manual, I find "sample" and "smpl" commands, but they require a pair of numbers that indicate the start and the end of the range, so such samples not random samples. I have reviewed Monte Carlo examples (that I could find), but they tend to use "smpl 1 !n" where !n is changing in each iteration. However, I want to randomly draw a subsample of a fixed size.

Thank you!
Rakkoo
Last edited by chungrak9 on Tue Jun 10, 2014 9:02 am, edited 1 time in total.

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

Re: Monte Carlo of STEPWISE regression

Postby EViews Gareth » Tue Jun 10, 2014 8:57 am

series.resample Details are in the Series section of the object reference.
Follow us on Twitter @IHSEViews

chungrak9
Posts: 16
Joined: Sat May 31, 2014 9:09 am

Re: Monte Carlo of STEPWISE regression

Postby chungrak9 » Tue Jun 10, 2014 10:14 am

Thank you very much again. It works! XD
Rakkoo


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 14 guests