Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

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

From   "Schaffer, Mark E" <>
To   <>
Subject   RE: st: ivreg2 with 1 lag ac correction, robust SE and cluster
Date   Thu, 18 Aug 2011 17:26:04 +0100


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.


> -----Original Message-----
> From: 
> [] On Behalf Of 
> Caspar Bijleveld
> Sent: 18 August 2011 14:04
> To:
> 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:
> *
> *
> *

Heriot-Watt University is a Scottish charity
registered under charity number SC000278.

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index