Bookmark and Share

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

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

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

From   Caspar Bijleveld <>
To   <>
Subject   FW: st: ivreg2 with 1 lag ac correction, robust SE and cluster
Date   Thu, 18 Aug 2011 13:04:15 +0000

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 variabl!
 e 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:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index