Statalist


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

Re: st: e(sample) not working after XTIVREG2


From   "Erasmo Giambona" <e.giambona@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: e(sample) not working after XTIVREG2
Date   Fri, 7 Nov 2008 14:50:39 +0100

Thanks very much Austin. I think this code is very close to what I
need but not completely. Indeed, I have l1. RHS variables. Therefore,
I modified your code as follows:

webuse grunfeld, clear
drop if time>2 & company==10
xtivreg2 mvalue l1.invest, fe
g s=e(sample)
egen c=count(s), by(company)
g ok=s*(c>2)
tab company ok

Things seem to work well in your example, but not in my case. This is
perhaps happening because my panel is unbalanced? Any suggestions on
what I should do in this case
Thanks,
Erasmo


On Fri, Nov 7, 2008 at 1:55 PM, Austin Nichols <austinnichols@gmail.com> wrote:
> Erasmo Giambona <e.giambona@gmail.com> :
> Do you want something like this?
>
> webuse grunfeld, clear
> drop if time>1 & company==10
> xtivreg2 mvalue invest, fe
> g s=e(sample)
> egen c=count(s), by(company)
> g ok=s*(c>1)
> tab company ok
>
> Note that -xtivreg2- is on SSC, and e(sample) works as expected when
> using the -fd- option.
>
> On Fri, Nov 7, 2008 at 6:22 AM, Erasmo Giambona <e.giambona@gmail.com> wrote:
>> Dear Prof. Schaffer and Statalisters,
>>
>> For some reasons, e(sample) does not seem to work after XTIVREG2. In
>> particular, if I run XTIVREG2 some observations are not used because
>> they are singleton (likely due to the fact that some of my RHS
>> variables are lagged 1 period relative to the dependent variable).
>> However, If I try to calculate summary statistics with the e(sample)
>> option (i.e., sum ...... if e(sample)), the singleton observations are
>> now used again. I contacted STATA Support about it. They cannot
>> explain why this happens and suggests that I contact you.
>>
>> I would appreciate if you or any Statalisters could suggest how I
>> could fix this problem.
> *
> *   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   |   What's new   |   Site index