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   Christopher Baum <>
To   "" <>
Subject   re: st: option bw() for ivreg2?
Date   Tue, 29 Jan 2013 18:39:27 +0000

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:

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