Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: computing preference choices
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: computing preference choices
Date
Tue, 27 Dec 2011 17:46:25 +0000
As with your last post, why not try -contract- first?
Nick
On 27 Dec 2011, at 08:16, Daniel Marcelino <[email protected]> wrote:
I dealing with a puzzle that I need some help. I have a data set where
I'd like to determine within "r" the most preferable choice (choice1
to n) as in the replication above.
So, there are three essential tasks: I need to tally the votes for
every id (number), I need to see if the number id with most votes has
at least 50%+ of all votes, and I need to discover who's the id the
the least amount of votes.
After performed these tasks in fly, I need to save the winner
information (r and which round choice), I need to proceed dropping id
got lesser votes in the first choice, but considering its second
choice vote. Test again if there is any id with 50%+ of all votes.
This procedure ends when any id gets 50%+ in each "r".
Daniel
clear
input str2 r w byte(choice1 choice2 choice3)
"a" .5 1 2 3
"a" .1 2 3 4
"a" .9 3 2 5
"a" .9 3 4 2
"a" .2 4 5 1
"a" .3 5 1 3
"b" .4 1 4 3
"b" .1 2 3 4
"b" .6 3 2 5
"b" .85 4 1 2
"b" .85 4 5 1
"b" .7 1 5 4
"c" .4 2 1 3
"c" .2 2 4 1
"c" .7 3 4 5
"c" .8 4 1 2
"c" .8 4 5 1
"c" .4 5 4 3
"d" .4 . 1 3
"d" .2 2 4 .
"d" .7 . 5 .
"d" .8 4 1 2
"d" .8 4 5 1
"d" .4 . . .
end
*
* 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/