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: how to do fixed effects with weights? (problem using svy: with xtreg, fe)

From   Stas Kolenikov <>
Subject   Re: st: how to do fixed effects with weights? (problem using svy: with xtreg, fe)
Date   Sun, 11 Apr 2010 23:46:27 -0500

In fact, -xtreg- satisfies the Stata's internal requirements needed
for -vce(jackknife)- that -if- conditions and [pweights] be accepted
and processed by the command, and the results be returned in e(b) and
e(V) matrices (plus a little bit of extra details; see -help program
properties-). So at your own risk you can write a very simple wrapper
like this:

program define myxtreg, eclass properties( svyj )

   * transfer the whole call to -xtreg-
   xtreg `0'

   * pretend we wrote a full fledge estimator here
   ereturn local cmd myxtreg


and try running your -svy, vce( jackknife ): myxtreg whatever- command
with it. This eliminates the need to do the jackknife "by hand" as
Steve S suggested, and if it does work, it will produce correct
results (it falls short of a proper Stata estimation command in a
number of ways, but I don't know whether that will be a problem since
you only need it for a specific purpose and won't distribute as an
estimation command that somebody else could use). This is a different
workaround than Steve's, that's all -- you'd HAVE TO write some
specialized code to make it work, and I would rather try to squeeze an
estimator into the existing -svy- paradigm than to write my own cycles
to process the jackknife weights.

Another issue that might bite you is that you might come across
weights that change from wave to wave for the same student. -xtreg-
will issue an error message, and that is the most reasonable behavior
in this situation.

On Sun, Apr 11, 2010 at 2:43 PM,  <> wrote:
> I am analyzing longitudinal data on children's educational achievement using
> the "xtreg, fe" command.  My challenge is that I can't seem to weight the
> data with the "svy:" command when running a fixed effects model.  I am
> working with Early Childhood Longitudinal Study-Kindergarten Cohort data
> from the National Center for Education Statistics; the study employed a
> multistage probability sample design (with three stages).
> As advised by a technical consultant at the American Institutes for
> Reserach, I am currently "survey setting" the data using replicate weights
> as follows:
> svyset [pweight=c1_5fp0], jkrweight( c1_5fp1-c1_5fp90, multiplier(1))
> I then attempted to run the fixed effects model with this syntax:
> svy jacknife: xtreg ztime incneed married momwork numchild, i(childid2) fe
> I receive the following error message:
> xtreg is not supported by svy with vce(jackknife)

Stas Kolenikov, also found at
Small print: I use this email account for mailing lists only.

*   For searches and help try:

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