Statalist The Stata Listserver


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

st: running -ktau- and storing its results for each observation


From   "Kelvin Foo" <[email protected]>
To   statalist <[email protected]>
Subject   st: running -ktau- and storing its results for each observation
Date   Thu, 16 Nov 2006 23:24:31 +0000

Dear Statalisters,

I have a dataset where individuals rank items from 1 to 10 in the
years 1990 and 2005. I would like to find the Kendall's tau statistic
for each individual's rankings of items between these two years, and
store the results in a new variable. In my dataset, the individuals
are the observations and the rankings are stored in 20 variables,
named A_90, B_90... J_90, A_05, B_05,.. J_05. A to J are the 10 items
and '90', '05' are the years.

How can I carry out this task?

My guess is to first use -reshape- to have 1990's rankings stored in
one variable (rank90), and 2005's rankings in another variable
(rank05). Each individual would have an identifier number associated
with him, and this will appear 10 times in the reshaped long format.

Next, I was thinking of running

generate correl=. // variable for storing Kendall tau results
by identifier: ktau rank90 rank05

But how do I get Stata to store the r(tau_a) result in correl for each
individual before moving on to the next one?

Or is there an alternative way in which I can find the Kendall tau for
each observation, given that my rankings are stored across different
variables?

Thanks for any suggestions.

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