Trying to run iterative regressions on a subsample of series

For questions regarding programming in the EViews programming language.

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

eBopBob
Posts: 3
Joined: Fri Jun 28, 2019 1:59 am

Trying to run iterative regressions on a subsample of series

Postby eBopBob » Wed Oct 09, 2019 2:15 am

Hi

I am trying to run iterative regressions. The code works for the full sample. However, I have now introduced a dummy variable called ANN which takes value 1 or 0. I want to run the regressions only on the subset where ANN takes value 1. I thought the best approach would be to use an IF statement, basically saying that if the variable takes value 1 to include that in the iterative regressions.

The code I am trying is this but it doesn't work:

Code: Select all

'create matrix to store coefficients. We'll be running 15 regressions (so 15 columns) with two coefficients in each, so two rows matrix(2,61) coefs matrix(2,61) stderrs 'create empty equation to be used inside the loop equation eq if ann=1 'run pairwise regressions between Y and each X for !i=0 to 60 'estimate equation eq.ls(cov=hac) gbpusd c ois_{!i}m 'store coefficients into matrix colplace(coefs, eq.@coefs, !i+1) colplace(stderrs, eq.@stderrs, !i+1) 'std errs next endif

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

Re: Trying to run iterative regressions on a subsample of series

Postby EViews Gareth » Wed Oct 09, 2019 8:04 am

http://eviews.com/Learning/programming_a.html
Slide 40.

You cannot use an if statement on a series, you must use a smpl if


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests