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 17:44:26 +0100

Hi Austin,

I have tried a lot of different things but that code does not work for
my data. That is, if I try to summarize the data using "sum ..... if
ok==1" I still get that the summary statistics are based on more
observations than those used for the XTIVREG2 runs. As I said before,
the "only" apparent difference between my data and your example is
that I use lagged RHS variable in XTIVREG2 and my panel is unbalanced
and with gaps.

I will keep thinking about this, but should you have any further
thoughts please let me know.
Thanks,
Erasmo




On Fri, Nov 7, 2008 at 3:42 PM, Austin Nichols <austinnichols@gmail.com> wrote:
> That example seems to work fine.  What exactly are you looking for in
> that example that you don't see?
>
> On Fri, Nov 7, 2008 at 8:50 AM, Erasmo Giambona <e.giambona@gmail.com> wrote:
>> 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