[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Sum over all possible combinations

From   "Nick Cox" <>
To   <>
Subject   st: RE: Sum over all possible combinations
Date   Sun, 22 Jul 2007 18:41:24 +0100

This sounds like 

	number in group * Gini mean difference * 2 

As the second L-moment is 

	Gini mean difference / 2 

-lmoments- from SSC will get you most of the way 

For example, 

lmoments varname, by(group) gen(n=n sad=l2) 
replace sad = 4 * n * l2 

Check this out with hand-calculations for a toy example. 


Julio E
> I am interested in computing the sum of the absolute value of 
> all possible 
> differences within a group of my sample.
> Suppose that the variable "group" denotes the variable 
> indicating the group 
> to which an individual belongs and Y is an outcome variable. 
> I am interested 
> in computing
> sum of abs (Yi-Yj) for all i and j  belonging to group K
> My programming skills are almost none. Can somebody help me 
> out regarding an 
> efficient way of computing such statistic?

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index