Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: How do I save fixed panel effects as a variable


From   "Rodrigo Alfaro" <ralfaro@bu.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: How do I save fixed panel effects as a variable
Date   Thu, 30 Mar 2006 17:18:50 -0500

I think that you have to do the following:

xi: reg btm r0ret r1ret r2ret r3ret r4ret r5ret r6ret i.yeara i.permno
* which give you fixed-effect with time-dummies.

mat beta =e(b)
* taking the vector coeff

mat fe=beta[1,13...?]
* taking the columns of fixed effects vector

mat score effect = fe
* creating the variable that you want.

Type -help mat score-  for a full description of the last sentence.

Rodrigo.


----- Original Message -----
From: "Amy Dunbar" <Amy.Dunbar@business.uconn.edu>
To: <statalist@hsphsun2.harvard.edu>
Sent: Thursday, March 30, 2006 4:46 PM
Subject: st: How do I save fixed panel effects as a variable


>I have a balanced panel data set.  I estimate the model of book to
> market on the current year stock return and 6 lagged returns.
>
> tsset permno yeara
>        panel variable:  permno, 10051 to 92655
>        time variable:  yeara, 1993 to 1998
>
> xi: xtreg  btm r0ret r1ret r2ret r3ret r4ret r5ret r6ret i.yeara
> i.permno
>
> I would like to save the fixed effect for each group variable (the
> b[_Ipermno_90537] for all permnos) under a common variable name
> (conmkt), so I can use the effect in another regression.
>
> I then unsuccessfully tried
>
> statsby "xi: xtreg  btm r0ret r1ret r2ret r3ret r4ret r5ret r6ret
> i.yeara i.permno" _b, by(permno)
>
> rename b_[i.permno] conmkt
>
> The estimation results were as follows:
> command:      xi: xtreg btm r0ret r1ret r2ret r3ret r4ret r5ret r6ret
> i.yeara i.permno
> statistics:   b_r0ret    = _b[r0ret]
>              b_r1ret    = _b[r1ret]
>              b_r2ret    = _b[r2ret]
>              b_r3ret    = _b[r3ret]
>              b_r4ret    = _b[r4ret]
>              b_r5ret    = _b[r5ret]
>              b_r6ret    = _b[r6ret]
>              b__Iy~1994 = _b[_Iyeara_1994]
>
> And on and on for the remaining firms.
>              b__I~90537 = _b[_Ipermno_90537]
>              b__I~90879 = _b[_Ipermno_90879]
>
>              b__I~91380 = _b[_Ipermno_91380]
>              b__I~92655 = _b[_Ipermno_92655]
>              b_cons     = _b[_cons]
> by:           permno
> too many options
>
> Stata limits the options to 50 and I have more around 500.
>
> I also tried:
>
> xi: xtreg  btm r0ret r1ret r2ret r3ret r4ret r5ret r6ret i.yeara
> i.permno
> estimates store fixed_group
> gen conmkt = _b[i.permno]
>
> But that failed also.  Obviously I don't know what I am doing.  I had a
> PhD student who was able to do this in SAS, so I know I should be able
> to do it in Stata.  I am using Stata SE 8 for Windows.  Thank you.
>
> Amy Dunbar
> University of Connecticut
> School of Business
> Department of Accounting
> 2100 Hillside Road, Unit 1041
> Storrs, CT 06269
>
> amy.dunbar@business.uconn.edu
> cell: 860-208-2737
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2020 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index