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

st: RE: egen rskew()


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: egen rskew()
Date   Tue, 20 Apr 2004 12:41:09 +0100

I am not aware of any such. 

One strategy is to -reshape-, use -egen, skew()- 
and -reshape- back again. 

Another is to do something like this, assuming 
the number of variables concerned to be less 
than the number of observations. 

gen holddata = . 
gen rskew = . 

local nvars : word count <spelled out variable list> 
tokenize <spelled out variable list> 

qui forval i = 1/`=_N' { 
	forval j = 1/`nvars' { 
		replace holddata = ``j''[`i'] in `j' 
	} 
	sum holddata, detail 
	replace rskew = `r(skewness)' in `i' 
} 
		

Nick 
n.j.cox@durham.ac.uk 

Mark Clatworthy
 
> Does anyone know if there is a row function which will 
> generate the skewness of
> a variable across observations, sort of equivalent to the 
> rsd() row standard
> deviation under egen?

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