Statalist


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

st: RE: Sum over all possible combinations


From   "Nick Cox" <[email protected]>
To   <[email protected]>
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 
there. 

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. 

Nick 
[email protected] 

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:
*   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