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]

st: RE: Two level fixed effect with Newey-West standard errors

From   "Schaffer, Mark E" <>
To   "" <>
Subject   st: RE: Two level fixed effect with Newey-West standard errors
Date   Wed, 4 Dec 2013 14:47:35 +0000


> -----Original Message-----
> From: [mailto:owner-
>] On Behalf Of Mohamad Mahmoud
> Sent: 03 December 2013 15:44
> To: statalist
> Subject: st: Two level fixed effect with Newey-West standard errors
> Hi,
> I need to estimate a two level fixed effects model with Newey-West
> standard errors. I use -xtivreg2- and I know that it does the job, however it is
> extremely slow. I am using a very large database (6 million observations, 30
> covariates, 4000 company fixed effects, 5000 date fixed effects) and it takes
> multiple hours for each regression.
> is there a fast command to execute this?

-xtivreg2- supports only 1-way fixed effects, so I am not sure how you are doing this.  Are you including dummies for the date FEs and letting -xtivreg2- handle the company FEs?

In any case, you might be able to speed things up by partialling out the date and company FEs by hand (i.e., transform your data by 2-level demeaning), and then just use -ivreg2-.  Depending on your choice of covariance estimator, you might have to adjust the variance/SEs by hand afterwards for the loss of degrees of freedom from the FEs, but that's not too hard.

> Thanks,
> Mohamad Mahmoud
> *
> *   For searches and help try:
> *
> *
> *

Sunday Times Scottish University of the Year 2011-2013
Top in the UK for student experience
Fourth university in the UK and top in Scotland (National Student Survey 2012)

We invite research leaders and ambitious early career researchers to 
join us in leading and driving research in key inter-disciplinary themes. 
Please see for further information and how
to apply.

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

*   For searches and help try:

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