Page 1 of 1

Dummy Variables in OLS

Posted: Sat Jul 25, 2009 3:56 pm
by keshav.jayant
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.

Re: Dummy Variables in OLS

Posted: Sat Jul 25, 2009 8:02 pm
by startz
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.

Re: Dummy Variables in OLS

Posted: Sun Jul 26, 2009 5:05 am
by keshav.jayant
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

Re: Dummy Variables in OLS

Posted: Sun Jul 26, 2009 8:10 am
by EViews Gareth
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

Re: Dummy Variables in OLS

Posted: Sun Jul 26, 2009 8:27 am
by keshav.jayant
Great thanks alot! really appreciate the help there.
cheers!