Page 1 of 1

Monte Carlo of STEPWISE regression

Posted: Mon Jun 09, 2014 1:55 pm
by chungrak9
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

Re: Monte Carlo of STEPWISE regression

Posted: Mon Jun 09, 2014 2:06 pm
by EViews Gareth
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).

Re: Monte Carlo of STEPWISE regression

Posted: Tue Jun 10, 2014 8:44 am
by chungrak9
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

Re: Monte Carlo of STEPWISE regression

Posted: Tue Jun 10, 2014 8:57 am
by EViews Gareth
series.resample Details are in the Series section of the object reference.

Re: Monte Carlo of STEPWISE regression

Posted: Tue Jun 10, 2014 10:14 am
by chungrak9
Thank you very much again. It works! XD
Rakkoo