Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: xtsum -- meaning of within "min" and "max"


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: Re: xtsum -- meaning of within "min" and "max"
Date   Wed, 16 Jul 2003 22:18:32 -0500

----- Original Message ----- 
From: "david reinstein" <[email protected]>
To: <[email protected]>
Sent: Wednesday, July 16, 2003 7:32 PM
Subject: st: xtsum -- meaning of within "min" and "max"


> The "min" and "max" part of the within column of xtsum
> confuses me -- it must be some sort of difference, but
> I cant figure out what!  It gives strange fractional
> values for 0,1 variables, gives absurdly large or
> small values in some cases, sometimes gives negative
> values, but gives only positive values for an income
> variable.
> -Anyone know what this is doing?
>

The within transformation demeans the data.  In particular, it substracts
the group mean and then adds in the overall mean to the series.


Try this:

. use http://www.stata-press.com/data/r8/grunfeld.dta

. by com: egen double invest_bar = mean(invest)

. egen double invest_bar2 = mean(invest)

. gen double invest_demeaned = invest - invest_bar + invest_bar2

. xtsum invest

Variable         |      Mean   Std. Dev.       Min        Max |
Observations
-----------------+--------------------------------------------+-------------
---
invest   overall |  145.9583   216.8753        .93     1486.7 |     N =
200
         between |             198.8242     3.0845     608.02 |     n =
10
         within  |             106.1986  -204.3617   1024.638 |     T =
20

. sum invest_demeaned

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
invest_dem~d |       200    145.9583    106.1986  -204.3617   1024.638



Hope this helps,
Scott



*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index