Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Panel mixed-effects models


From   Sam Schulhofer-Wohl <sschulh1.work@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Panel mixed-effects models
Date   Mon, 12 Mar 2012 08:43:58 -0500

To get fixed-effect intercepts and a non-zero average coefficient on
x, I think you will need:

xtmixed y i.panelID x || panelID: x, nocons

(Without the i.panelID in the fixed-effects equation, the intercept
will be the same for all values of panelID. Without the x in the
fixed-effects equation, the mean of the coefficients on x is
restricted to be zero.)

If the sample size is very large, you may also want to try mcmcmixed,
which is part of the mcmclinear package on SSC. mcmcmixed produces
Bayesian estimates of this model and can be much faster in large
datasets. The syntax for mcmcmixed is similar to that for xtmixed,
except that you must specify a prior and a place to save the posterior
draws, and you cannot use factor variables:

ssc install mcmclinear
scalar mydelta0=0.01
xi i.panelID
mcmcmixed y _I* x || panelID: x, noconstant saving(myoutputfile.dta)
d0(0.01) delta0(mydelta0)

See the help file for mcmcmixed for further advice on using this program.

Best,

Sam


-- 
Sam Schulhofer-Wohl
Senior Economist
Research Department
Federal Reserve Bank of Minneapolis
90 Hennepin Ave.
Minneapolis MN 55480-0291
(612) 204-5484
wohls@minneapolisfed.org

Views expressed herein are those of the author and not necessarily
those of the Federal Reserve Bank of Minneapolis or the Federal
Reserve System.



On Thu, Mar 8, 2012 at 3:19 PM, Jeph Herrin <stata@spandrel.net> wrote:
> If your panel id is panelID, try:
>
>  xtmixed y || panelID: x, nocons
>
> which specifies that x is random across panels but the intercept is not.
>
> hth,
> Jeph
>
>
>
> On 3/8/2012 1:13 PM, Downey, Patrick wrote:
>>
>> Hi David,
>>
>> Thanks for your response. As you suggested, I misspoke. I meant that I
>> expect the individual effects to be correlated with the covariates (X), as
>> you said, which violates the assumptions required for random individual
>> effects.
>>
>> I agree with you that it is a bit odd to have random slopes and fixed
>> intercepts, but I can't think of anything that would be wrong with it. It
>> feels strange, but I haven't found any reason why it shouldn't be
>> possible.
>>
>> -Mitch
>>
>> -----Original Message-----
>> From: owner-statalist@hsphsun2.harvard.edu
>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of David Hoaglin
>> Sent: Thursday, March 08, 2012 1:04 PM
>> To: statalist@hsphsun2.harvard.edu
>> Subject: Re: st: Panel mixed-effects models
>>
>> The random-effects model does not assume absence of correlation between
>> individual effects (e.g., random intercepts) and Y.  Indeed, such effects
>> are often the main source of the correlation structure for Y.  Did you
>> have
>> in mind the assumption that the random effects are not correlated with the
>> covariates (here, X_it)?  It seems a little odd to have random slopes but
>> fixed intercepts.
>>
>> David Hoaglin
>>
>> On Thu, Mar 8, 2012 at 12:12 PM, Downey, Patrick<PDowney@urban.org>
>>  wrote:
>>>
>>> Hello,
>>>
>>> I am trying to estimate a panel model of the form:
>>> Y_it = a_i + a_t + B_i * X_it + e_it
>>>
>>> I would like to use fixed effects for both of the 'a' coefficients
>>> because I believe that the individual-effects are correlated with Y
>>> (so the assumptions for random effects are not met). That would be a
>>> simple two-way fixed effects model. However, I would like to use
>>> random effects for the B coefficient. Thus, I want to assume B_i = B +
>>> n_i, where n_i is a normally distributed random variable.
>>>
>>> I cannot figure out how to estimate this model in Stata. It seems that
>>> xtmixed should be able to handle it, but with large N or large T, I
>>> think there are complications. I couldn't find examples (for xtmixed
>>> or xtrc) that use fixed effects for individual- or time- effects but
>>> random slope coefficients, although I think this is possible.
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index