Dummy Variables in OLS

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

keshav.jayant
Posts: 6
Joined: Sat Jul 25, 2009 3:19 pm

Dummy Variables in OLS

Postby keshav.jayant » Sat Jul 25, 2009 3:56 pm

I am trying to draw the relationship between trading volume and unconditional volatility. For this purpose I am using the following equation:

log(Vt )= α + β1 Rt^2 + β2 Dt Rt^2

Where,
Vt is volume at time 't',
Rt is return at time 't' and,
Dt = 1 when Rt<0 and D=0 when Rt≥0.

For the dummy variable Dt, I am unable to insert the appropriate code into EViews. I had a look at the EViews guide but I am unable to construct the dummy variable with the required condition (highlighted).
I wanted to know if it is correct if I put the data into EXCEL and with the help of the 'IF' statement, I construct the table for the dummy variables and then import into EViews (for each individual stock) and run the OLS regression. Will it yield the correct coefficients? I tried to do one for an example and I would appreciate it if you could advise me whether it has been done correctly. If so, I can carry on with the rest of my tests and analysis accordingly.

A sample of the EXCEL file is attached above with the corresponding data (for one stock from the index) and the OLS regression output. I have run the OLS with the equation as given above. I would appreciate it much if you could have a look at this and advise me if I am on the right track.
Attachments
EXAMPLE OUTPUT.xlsx
Contains both the data and the estimation output
(60.21 KiB) Downloaded 550 times

startz
Non-normality and collinearity are NOT problems!
Posts: 3797
Joined: Wed Sep 17, 2008 2:25 pm

Re: Dummy Variables in OLS

Postby startz » Sat Jul 25, 2009 8:02 pm

one method

Code: Select all

series dummy = @recode(r<0,1,0)
D is a reserved word and shouldn't be used as a variable name.

keshav.jayant
Posts: 6
Joined: Sat Jul 25, 2009 3:19 pm

Re: Dummy Variables in OLS

Postby keshav.jayant » Sun Jul 26, 2009 5:05 am

Hi,

Thanks for your reply. So inorder to compute the OLS for this case would the appropriate code in the OLS estimate box be the following?:

Code: Select all

log(Volume)=c(1) + c(2)*(returns) + c(3)*dummy*(returns)
Please advise if this is the correct manner in which it must be written.
Appreciate the help.
Keshav

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

Re: Dummy Variables in OLS

Postby EViews Gareth » Sun Jul 26, 2009 8:10 am

Either that or just simply

Code: Select all

log(volume) c returns dummy*returns

Although looking at your original specification, perhaps it should be:

Code: Select all

log(volume) c returns^2 dummy*returns^2

keshav.jayant
Posts: 6
Joined: Sat Jul 25, 2009 3:19 pm

Re: Dummy Variables in OLS

Postby keshav.jayant » Sun Jul 26, 2009 8:27 am

Great thanks alot! really appreciate the help there.
cheers!


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests