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: xtivreg2 with factor variables

From   David Torres <>
To   "" <>
Subject   RE: st: xtivreg2 with factor variables
Date   Mon, 30 Dec 2013 17:34:40 -0500


Try the xi: operator before the command.

xi: xtivreg2 log_ss dem gini gdp i.year, fe cluster(country_code year) bw(1)

That will automatically break year out into dummy variables.

I'm surprised, though, that you're using -xtivreg2- in the absence of any instruments.  I would argue that if you want to treat year as continuous, you should rethink the model.  You might also prefer using -xtivreg- over -xtivreg2-.  For instance, say you need to instrument for one of the variables in your model, say gdp.  Let's give the instrument a generic name, say rainfall.  You would do something like this:

xtivreg log_ss dem gini c.year (gdp = rainfall), re vce(cluster country_code)

and interactions are also possible:

xtivreg log_ss dem gini gini#c.year (gdp = rainfall), re vce(cluster country_code)

The last model here assumes gini is a time-invariant predictor for which you want to know its relationship to time.



David Diego Torres, PhD
NSF SBE Postdoctoral Research Fellow
Houston Education Research Consortium
Rice University
6100 Main Street, MS-28
Houston, TX 77005
Phone: 713-348-2984
Email: ddtorres at rice dot edu

> Date: Tue, 31 Dec 2013 00:15:11 +0200
> Subject: st: xtivreg2 with factor variables
> From:
> To:
> Dear all,
> I have an unbalanced panel of macroeconomic data on 35 countries over 17 years.
> My analysis shows that time effects are jointly significant, as well
> as indicated first order autocorrelation.
> I
> therefore ran the following command:
> . xtivreg2 log_ss dem gini gdp i.year, fe cluster(country_code year) bw(1)
> I got the following error: factor variables not allowed
> Shell I specify each year dummy (excl. one) or is there a different
> problem here?
> Any advise will be appreciated!
> Anat
> --
> Anat Tchetchik, PhD
> Department of Business Administration
> Guilford Glazer Faculty of Business and Management
> Ben-Gurion University of the Negev
> P.O.Box: 653
> Beer-Sheva, Israel, 84105
> E-mail:
> Phone 972-(0)8-6479735
> Fax: 972-(0)8-6472920
> *
> * For searches and help try:
> *
> *
> * 		 	   		  
*   For searches and help try:

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