[Gretl-devel] cross-sectional mean, variance

Allin Cottrell cottrell at wfu.edu
Wed Feb 13 14:08:15 EST 2008


On Wed, 13 Feb 2008, Sven Schreiber wrote:

> That's a nice feature, but in general I believe that one needs 
> weighted statistics where the size of the cross-sectional units 
> are taken into account. (From my recent experience with 
> cross-sectional price dispersion.)

Good point.  I've added wmean, wsd and wvar (plus help items).
Revised sample script with weighting by population:

<script>

# open US state/regional database on server
open beapira --www
setobs 1 1929 1973
# d/l regional income per capita, population
data a91200 a92200 a93200 a94200 a95200 a96200 a97200 a98200
data a91300 a92300 a93300 a94300 a95300 a96300 a97300 a98300
list ylist = a*200
list wtlist = a*300
# weighted cross-sectional mean, std. dev., c.v.
genr Lm = wmean(ylist, wtlist)
genr Ls = wsd(ylist, wtlist)
genr Lcv = Ls/Lm
print Lm Ls Lcv --byobs

</script>

Allin.


More information about the Gretl-devel mailing list