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]

RE: st: option bw() for ivreg2?

From   Anja Lambrecht <>
To   "" <>
Subject   RE: st: option bw() for ivreg2?
Date   Tue, 29 Jan 2013 20:41:39 +0000


Both were the case.

I reinstalled ivreg2 and now have the most up-to-date version

When using ivreg2 I was using panel data and dummies to capture the fixed effects (only 6 needed). When I now do the same in the updated version I indeed get the error message below. Same for xtivreg2 when specifying fixed effects but excluding the dummies.

My panel variable only has six values. So I could perhaps run ivreg2 with bw(auto) for each one separately and let it determine the bandwidth, then use this in xtivreg2. Would such an approach be appropriate?

Lastly, when I try to run the model with newey instead of ivreg2 I get the message that time-variable is not regularly spaced. Indeed, there are occasionally days missing in my panel. But I do not get the message with ivreg2. Does this mean that ivreg2 is not sensitive to whether the time-variable is regularly spaced? Or is it still not appropriate to use ivreg2? In that case, what do you recommend when there are missing observations in the panel?

Thanks again,

-----Original Message-----
From: [] On Behalf Of Christopher Baum
Sent: 29 January 2013 18:39
Subject: re: st: option bw() for ivreg2?

Anja said

I'm estimating a panel model with ivreg2 and want to use the option for heteroskedastic and autocorrelation-consistent standard errors. In previous discussions the automatic bandwidth selection option bw(auto) was recommended. However, I always get the message "invalid bandwidth in option bw() - must be integer > 0" and also the help text does not seem to mention this option. Is it not implemented anymore or is it possible to go back to previous versions of stata to use this? I am not sure which level is appropriate, hence the option would be really useful.

.which ivreg2

*! ivreg2 3.1.06  27Dec2012

. webuse lutkepohl,clear
(Quarterly SA West German macro data, Bil DM, from Lutkepohl 1993 Table E.1)

. ivreg2 investment (income = L(1/3).income), robust bw(auto)

IV (2SLS) estimation

Estimates efficient for homoskedasticity only
Statistics robust to heteroskedasticity and autocorrelation
  kernel=Bartlett; bandwidth=20
  Automatic bw selection according to Newey-West (1994)
  time variable (t):  qtr

Works fine for me. It sounds like you do not have the most up-to-date version of the program installed from SSC, as the current help file includes " When using the Bartlett, Parzen, or Quadratic spectral kernels, the automatic bandwidth selection procedure of Newey and
West (1994) can be chosen by specifying bw(auto)."

However, if this is panel data, you should be using -xtivreg2-, not -ivreg2-.  If you try using bw(auto) with panel data, you will get

.webuse grunfeld

. ivreg2 invest (mvalue=L(1/2).kstock), robust bw(auto)
Automatic bandwidth selection not available for panel data

but not the error message you mention.  Note that Mark Schaffer's -xtivreg2- does not support auto bw selection.


Kit Baum   |   Boston College Economics & DIW Berlin   |
                             An Introduction to Stata Programming  |
  An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

*   For searches and help try:

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