Would it also be possible to -xpose,clear- and then to calculate the
skewness and kurtosis for the former rows, now columns with -
summarize-?
Admittedly a little quick and dirty...
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Matt
Spittal
Sent: Tuesday, October 14, 2008 5:22 AM
To: [email protected]
Subject: st: RE: rowskew?
jeheyman,
You can use the moments about the mean to calculate skew and
kurtosis for a
row of variables. Imagine that you want to do this for the variables
weight, length and price from the auto dataset.
sysuse auto, clear
// get mean and N
egen rowmean = rowmean(weight length price)
egen rowN = rownonmiss(weight length price)
// calculate 2, 3, and 4th moments about the mean
gen m2 = 1/rowN * ((weight - rowmean)^2 + (length - rowmean)^2 +
(price - rowmean)^2)
gen m3 = 1/rowN * ((weight - rowmean)^3 + (length - rowmean)^3 +
(price - rowmean)^3)
gen m4 = 1/rowN * ((weight - rowmean)^4 + (length - rowmean)^4 +
(price - rowmean)^4)
// calculate skew and kurtosis
gen rowskew = m3*m2^(-3/2)
gen rowkurt = m4*m2^(-2)
list weight length price rowskew rowkurt in 1/10
-- Matt
[email protected]
-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of jeheyman
Sent: Tuesday, 14 October 2008 12:31 PM
To: [email protected]
Subject: st: rowskew?
Is it possible to calculate essentially a rowskew and rowkurtosis in
the same way that egen calculates rowmean?
For each observation I have 18 variables and I need, obviously, the
three distribution measures. Mean is trivial but the other two are
proving elusive. I feel like I'm overlooking something obvious and
posting seemed to be better than continuing to bang my head against
the wall.
Thanks.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/