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

st: RE: Programming Problem


From   "Nick Winter" <nwinter@policystudies.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Programming Problem
Date   Fri, 19 Jul 2002 11:17:18 -0400

I'm not entirely clear on the algorithm here.  Is it:

1. Assign a seat to current highest vote getter.
2. Divide that party's votes by (1+number of seats they've been awarded
so far).
3. Return to step 1, until all seats are assigned.

Nick Winter


> -----Original Message-----
> From: Guido Tiemann [mailto:tiemann@uni-greifswald.de] 
> Sent: Friday, July 19, 2002 11:08 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Programming Problem
> 
> 
> Hm, somehow my posting got returned and. Hence, I send it 
> again, hopefully 
> that will not be a double posting.
> 
> GT
> 
> _____________________
> 
> Hi!!
> 
> My topic is not so much a specific or technical question, but 
> a full-scale 
> request for help. I already did a quick and dirty solution 
> working with 
> many dummy variables. Unfortunately, it turned out to be 
> neither elegant 
> nor "quick".
> 
> My problem: I would like to program a vote --> seat 
> conversion in electoral 
> systems applying the d'Hondt formula. Hence, in my dataset 
> each observation 
> consists of the absolute number of votes for each party i 
> (v1, v2, v3, ..., 
> vi) and I want to obtain the respective number of seats (m1, 
> m2, m3, ..., 
> mi). The d'Hondt highest averages method, applied in an 
> electoral district 
> returning m seats, works as follows: The absolute vote 
> numbers are divided 
> by a sequence of integers which, in case of d'Hondt, is 
> simply 1,2,3,..., 
> and the m seats are sequentially awarded to the parties with 
> the highest 
> averages.
> 
> An Example concerning a six-member district:
> 
> div 1 div 2 div 3
> 
> V1 41000 (1) 20500 (3) 13667 (6) = 3 seats
> V2 29000 (2) 14500 (5) 9667 = 2 seats
> V3 17000 (4) 8500 = 1 seat
> V4 13000 = no seat
> 
> In this example, the first seat is awarded to party 1 
> (receiving 41000 
> votes), the second to party 2 (receiving 29000) votes, the 
> third again to 
> party 1 (for 41000/2=20500 votes) and so on.
> 
> My quick and dirty solution deals with lots of dummy 
> variables, and is for 
> that reason pretty slow. I suppose some sort of matrix 
> programming would do 
> much better, but I was not able to program it.
> 
> Any ideas? Any help would be greatly appreciated!!
> 
> Guido Tiemann
> 
> *
> *   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/
> 
*
*   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