Page 1 of 1

Estimation by sym

Posted: Thu May 05, 2011 7:41 am
by basil
How do you estimate a regression by sym?

I am running a regression on financial market data that includes the columns: date, sym (ticker of the company), price, volume. For each sym, I would like, say, to run the following regression and collect the coefficients and R2: price c price(-1) volume
Note, that the data is not a balanced panel.

Thanks for the help.
Basile

Re: Estimation by sym

Posted: Thu May 05, 2011 7:58 am
by EViews Gareth
I'm not sure what you're asking here. But it seems to me you just need to write a program with a for loop, that loops over each "sym", and creates an equation for each one.

Re: Estimation by sym

Posted: Thu May 05, 2011 8:48 am
by basil
Thanks very much Gareth for your quick response.

Agreed, a loop will do. I was thinking whether there is an option by EViews that would allow doing this straightforward whether having to go thru a loop.

The loop that i thought of, would loop over the different values of sym, and then restrict the sample to that sym, run the regression, and collect the needed coefficients into a table. When tried to do a loop, I stumbled upon two issues.

(1) Does EViews have a function that can allow me to create a distinct list of the sym saved into a table (say, named syms)? The sym column is type of alpha
(2) When I run a regression with "sample if sym=syms(1)" i get an error msg "Error in Sample: Illegal or index specification for series syms(1)

I appreciate your help and quick response.
Basile

Re: Estimation by sym

Posted: Thu May 05, 2011 9:09 am
by EViews Gareth
You can use one-way tabulation to get a list of unique values. It isn't the perfect interface, but it can be used.

Re: Estimation by sym

Posted: Thu May 05, 2011 9:19 am
by basil
Thanks EViews Gareth.

What about the error?
(2) When I run a regression with "sample if sym=syms(1)" i get an error msg "Error in Sample: Illegal or index specification for series syms(1)

Re: Estimation by sym

Posted: Thu May 05, 2011 9:24 am
by EViews Gareth
What is syms?

Re: Estimation by sym

Posted: Thu May 05, 2011 9:33 am
by basil
"syms" is a table of distinct "sym".

Re: Estimation by sym

Posted: Thu May 05, 2011 9:39 am
by EViews Gareth

Code: Select all

%val = syms(1,1) smpl if sym = %val

Re: Estimation by sym

Posted: Thu May 05, 2011 10:03 am
by basil
thx v much for the help.