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
Estimation by sym
Moderators: EViews Gareth, EViews Moderator
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Estimation by sym
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
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
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
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Estimation by sym
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
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)
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)
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Estimation by sym
What is syms?
Re: Estimation by sym
"syms" is a table of distinct "sym".
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Estimation by sym
Code: Select all
%val = syms(1,1)
smpl if sym = %val
Re: Estimation by sym
thx v much for the help.
Who is online
Users browsing this forum: No registered users and 2 guests
