Ernesto, you're approach is basically correct but you are adding a few
unnecessary steps. All you need to do is mean difference the data (no need
to add back in the overall mean), i.e. for each industry subtract off the
mean of all y, x, and z (instruments) variables. A convenient way to do
this is using the command xtdata, fe. You can then run IV with a cluster
adjustment using the user-written command ivreg2 (of which I am a
co-author). As you mention, the only extra step is to correct the SEs for
the i = # firms degrees of freedom lost in step 1. However, given that IV
only has large sample properties it is arguable whether this adjustment
needs to be done at all.
PS Our goal is to produce an xtivreg2 in the near future to accomplish
exactly what you are trying to do.
> -----Original Message-----
> From: Lopez Cordova, Jose E. [SMTP:JOSELC@iadb.org]
> Sent: Wednesday, November 20, 2002 3:11 AM
> To: 'firstname.lastname@example.org'
> Subject: st: -xtivreg, fe- and -cluster- option
> Dear Statalisters,
> I have an unbalanced panel of manufacturing plants on which I need to run
> fixed effects, two-stage least squares, correcting the standard errors to
> account for the fact that I have some grouped (industry-level) regressors.
> Unfortunately, Stata's --xtivreg, fe-- command does not include the
> --cluster()-- option available in other regression commands, such as
> --reg--, --areg-- or --ivreg--.
> I have been trying the strategy below to attack this problem. I would like
> to get your informed opinion on whether my approach is valid as well as
> more specific help on how to correct my standard errors.
> STEP 1. First, as in the --xtreg, fe-- or --areg-- commands, I transform
> the LHS and RHS variables, as well as the instruments, as follows:
> z~(it)= z(it) - z(i.) + z(..)
> where z~(it) (z-tilde) is the transformed z variable for plant i in period
> t; z(i.) is the mean of z for plant i and z(..) is the overall mean of z.
> STEP 2. Ignoring the more difficult case of 2SLS, I could then run OLS on
> the transformed model:
> y~(it)= Bo + B1 x~(it) + u(it)
> using the --reg, cluster-- command. I would need to correct my standard
> errors to account for the effect that the number of panels that appear in
> my original data has on the degrees of freedom.
> NOTE: The command --areg, cluster-- follows steps 1 and 2, as far as I
> STEP 3. When 2SLS is needed, I am assuming that using --ivreg, cluster--
> on the transformed model and IVs, correcting the standard errors, is a
> valid approach.
> I have followed this strategy for the case without 2SLS, using a balanced
> panel, and I can reproduce Stata's --areg, cluster-- results. However, I
> am still having problems replicating these results when I use an
> unbalanced panel. My guess is that I am not properly accounting for
> differences in the time dimension across panels when I correct my standard
> errors; I'm also guessing this might not be too difficult to fix.
> I also applied the above strategy to the case of 2SLS, with a balanced
> panel, using -ivreg, cluster- on the transformed variables, but I have no
> way to compare my estimates with any existing Stata output (which is
> precisely the problem I am trying to solve).
> My questions are:
> 1. Do you think the above strategy is sensible? Or are there other issues
> that I am ignoring that make it unviable? I am hesitant to continue
> ironing out some of the remaining problems if my approach is flawed.
> 2. If my approach is promising, do you have any suggestion as to how to
> correct standard errors for changes in the degrees of freedom that results
> from the panel structure of my data? Along the same lines, what kind of
> adjustment do I need to make to account for unbalance panels?
> Thanks in advance for your help.
> J. Ernesto Lopez-Cordova
> Integration, Trade, and Hemispheric Issues Division
> Inter-American Development Bank
> 1300 New York Ave. NW
> Stop W0608
> Washington, DC 20577
> Tel: (202)623-2469
> Fax: (202)623-2169
> Email: email@example.com
The information contained in this document is intended only for the
addressee and is not necessarily the views nor the official
communication of the Department of Labour. All final/official papers
which are sent from the Department will be sent by non-electronic
means, on appropriate letterhead, signed by authorised personnel.
* For searches and help try: