Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Schaffer, Mark E" <M.E.Schaffer@hw.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: ivreg2 with 1 lag ac correction, robust SE and cluster |

Date |
Thu, 18 Aug 2011 17:26:04 +0100 |

Caspar, Can you recast your setup as a panel? If you define a panel identifier that is =1 when the dep var is A and =2 when the dep var is B, you can -xtset- or -tsset- the data. --Mark > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of > Caspar Bijleveld > Sent: 18 August 2011 14:04 > To: statalist@hsphsun2.harvard.edu > Subject: FW: st: ivreg2 with 1 lag ac correction, robust SE > and cluster > > > > > Dear Statalisters, > > In my research I have used ivreg2 as a substitute for a > newey-west regression in order to get the r^2 for each model. > This worked perfectly fine. > > Now I have a question about running a regression with ivreg2 > including lags for autocorrelation, setting it to robust to > correct for heteroskedasticity and I need to cluster my data. > This is the case. I have quarterly observations of two > dependent variables, say A and B, and I have put these two > variables underneath each other so it becomes one variable. I > want to regress both variables on certain macro variables > which are also quarterly. Next I want to find out whether > variable A is being influenced more by a certain macro > variable than variable B. This I want to test with a > regression including dummies (dummy=1 when observation is for > variable A). The coefficient of the dummy variable will tell > me if there is significant difference in influence. > Since I have quarterly observations I want to correct for > autocorrelation of one lag, so I include bw(2) behind my > regression. I also want to correct for any heteroskedasticity > so I include robust small (small because I have 80 quarterly > observations). Now the problem is arising. I have two > observations per quarter, one for variable A and one for > variable B. I also have two observations per quarter for the > macro variables, but these are the same for each specific > quarter (therefore clustering is necessary). My time1 > variable shows 1,1,2,2,3,3,...,79,79,80,80 -> so 160 > observations (each observation two times). When I want to > tsset time1 it gives the error "repeated time values in > sample". So time1 is not possible to set as times series. If > I generate a new variable (say "count") and give every > observation a specific number from 1 till 160 and tsset this > new variable "count" I am not able to cluster it anymore > because there is no distinction between an observation for > variable A or variable B. I have also tried to set "count" as > tsset and cluster "time1" but this gives the error " cluster > kernel-robust requires clustering on tsset time variable. > tsset time var=count; cluster var=time1 ". > > Does anyone have an idea or suggestion how to cope with this problem? > Many thanks. > Caspar Bijleveld > > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > -- Heriot-Watt University is a Scottish charity registered under charity number SC000278. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**FW: st: ivreg2 with 1 lag ac correction, robust SE and cluster***From:*Caspar Bijleveld <cnbijleveld@hotmail.com>

- Prev by Date:
**Re: st: Looping through graphs w/ foreach?** - Next by Date:
**st: adjusted twoway table** - Previous by thread:
**FW: st: ivreg2 with 1 lag ac correction, robust SE and cluster** - Next by thread:
**st: margins command: adjusting predictions with means of a group not esimated** - Index(es):