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

Re: st: RE: Re: Tactical looping


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   Re: st: RE: Re: Tactical looping
Date   Mon, 26 Jan 2004 19:25:21 -0000 (GMT)

Michael,

Cheers for that. I'll try it out.

As I demonstrated via a (perhaps illegally posted) chart on the Statalist
last December, there has never been a tied constituency contest at a
British general election this side of 1900. So no worries there.

C.

> I think you could just insert :
>
> drop if pc==.
>
> right after the 1st reshape command, that way missing vote percents won't
> count as the highest.  Another approach would be to insert
>
> replace pc=0 if pc==.
>
> in the same spot, although this could conceivably declare a party in the
> top
> 3 if 0% is in the top 3 in any election.  Also, I just realized that the
> approach I showed will split ties randomly so if you have any ties, you
> may
> need to decide what to do about them.
>
> Michael Blasnik
> [email protected]
>
> ----- Original Message -----
> From: "Clive Nicholas" <[email protected]>
> To: <[email protected]>
> Sent: Monday, January 26, 2004 10:20 AM
> Subject: Re: st: RE: Re: Tactical looping
>
>
>> All,
>>
>> Michael Blasnik wrote:
>>
>> >> use mydata
>> >> reshape long @pc, i(id) j(party) string
>> >> bysort id (pc): gen byte rank=_N-_n+1
>> >> keep if rank<4
>> >> keep id party rank
>> >> reshape wide  party, i(id) j(rank)
>> >> sort id
>> >> save top3
>> >> use mydata
>> >> sort id
>> >> merge id using top3
>> >> assert _merge==3
>> >>
>> >> This assumes your file is called mydata and that there is some sort
>> of
>> >> election id variable, called id.  It keeps the top 3 as
>> >> party1 party2 and
>> >> party3.
>>
>> Ah. I forgot to mention something (but, in my defence, I didn't think it
>> would be crucial!). Many of my cases contain missing values for at least
>> one of the parties (particularly English seats, where there are no
>> equivalents to the Nationalist parties). In the cases where no
>> Nationalist
>> candidate appears, the orderings turn out all wrong!
>>
>> So what would I change in the above code to handle the missings? Sincere
>> apologies for any confusion.
>>
>> CLIVE NICHOLAS        |t: 0(44)191 222 5969
>
>
> *
> *   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/
>


CLIVE NICHOLAS        |t: 0(44)191 222 5969
Politics Building     |e: [email protected]
School of Geography,  |f: 0(44)870 126 2421
 Politics & Sociology |
University of         |
 Newcastle-upon-Tyne  |
Newcastle-upon-Tyne   |
NE1 7RU		      |
United Kingdom	      |http://www.ncl.ac.uk/geps
*
*   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