[Gretl-devel] cross-sectional mean, variance

Sven Schreiber svetosch at gmx.net
Wed Feb 13 03:44:38 EST 2008


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.)

-sven

Am 13.02.2008 07:38, Allin Cottrell schrieb:
> Serendipitous fallout from adding lists to genr.
> 
> It turns out that two of my students this semester are working on 
> research papers dealing with convergence or non-convergence (of 
> GDP per capita among ASEAN countries in one case, and of 
> employment characteristics among US cities in the other).
> 
> There are several ways of assessing convergence, but one nice 
> simple way to start is to create a time-series plot of the 
> cross-sectional variance (or coefficient of variation, perhaps)
> of the variable of interest.  Sigma-convergence, it's called: does 
> the variance show a declining trend, or what?
> 
> You can compute this in gretl, but it's a bit fiddly because gretl 
> is "column-oriented".  Suppose you have a time-series data set 
> with GDP for k countries or regions represented as k distinct 
> variables.  You can compute the desired time-series of 
> cross-sectional variance by (a) transposing the data set or (b) 
> stacking the data into a panel then looping across sub-samples 
> restricted by year.  Perfectly do-able but a bit daunting for a 
> beginner.
> 
> Lists to the rescue.  I've extended the functions mean(), sd() and 
> var() so that if you supply a list argument the result is a series 
> each of whose values is the cross-sectional statistic for the 
> listed variables in the given period.
> 
> Here's an example illustrating strong sigma-convergence of per 
> capita income across the regions of the US from the onset of the 
> second world war till around 1980. (Run in the GUI when connected 
> to the internet, and I hope you'll agree it's quite cool.)
> 
> <script>
> 
> # open US state/regional database on server
> open beapira --www
> setobs 1 1929 1973
> # d/l regional income per capita
> data a91200 a92200 a93200 a94200 a95200 a96200 a97200 a98200
> list L = a*
> # cross-sectional mean, std. dev., coeff of variation
> genr Lm = mean(L)
> genr Ls = sd(L)
> genr Lcv = Ls/Lm
> # print results
> print Lm Ls Lcv --byobs
> # time series plot of coeff of variation
> convplot <- gnuplot Lcv time --with-lines \
>  { set title "See the convergence?"; }
> convplot.show
> 
> </script>
> 



More information about the Gretl-devel mailing list