<>
-bys month asset: keep if _n==1-
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Stata Chris
Sent: Mittwoch, 5. August 2009 21:14
To: [email protected]
Subject: st: How to avoid inflating observation numbers and t-stats?
Dear Statalisters.
I have a question again.
In my dataset, in which each observation consists of a different
fund-asset-month triple (but not all asset-fund pairs are present in
each month), I have generated a variable "p_it" that varies across
asset-period pairs, but within each asset-period pair takes the same
value for all funds present.
Now I would like to regress (for each month) "p_it" on "L.p_it" (the
lag of "p_it"). Now I believe that If I simply type "reg p_it L.p_it"
I will get the right coefficient estimates, but inflated t-statistics,
because for each asset-month Stata would consider all (between 11 and
18) funds, although in fact within each asset-month the values of p_it
and L.p_it are the same for each fund.
To get around this, I was considering to keep only one fund with all
asset-month observations on p_it. But I cannot simply use say "keep if
fundid==1", because for some assey-months fund 1 (or any other, for
that matter) may not exist, although other funds may have observations
on that asset-month. I then considered to use "fillin fund asset
month", then fill in all values for fund 1 and then drop the others,
but using the fillin here would take forever.
So I was wondering whether I could generate one artifical fund (say
fundid==100) with observations on each asset-month, so that I could
then drop all other funds' observations and be left with exactly one
observation per asset-month. But I am not sure how to add observations
on each asset-month for this extra fund. Plus, this all seems a bit
complicated for what should be an easier problem.
Does anyone have an easier way of telling Stata that it should count
every unique month-asset as only one observation, regardless of which
fund it comes from?
Many thanks,
Chris
*
* 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/