Page 1 of 1

Created a C Program

Posted: Thu Aug 04, 2011 3:04 pm
by StriderV
I've created a C program which automatically apportions the states based on entered criteria. One thing I remember from reading a case about apportionment was a question of how close to one man, one vote would apportionment have to be to meet the requirements of the constitution. This program allows apportionment to a size determined by one of 3 functions.

First, you can simply enter a number of seats and it will assign the seats to fit that number. This is the way our seating currently works and is set to 435 seats.

Code: Select all

State           Seats  Population Ratio          State           Seats  Population Ratio
Alabama          7  +0 4779736    682819         Alaska           1  +0 710231     710231
AmerSamoa        0  +0 65628      0              Arizona          9  +0 6392017    710224
Arkansas         4  +0 2915918    728979         California      53  +0 37593222   709306
Colorado         7  +0 5029196    718456         Connecticut      5  +0 3574097    714819
Delaware         1  +0 900877     900877         Florida         27  +0 18801310   696344
Georgia         14  +0 9687653    691975         Guam             0  +0 178430     0
Hawaii           2  +0 1360301    680150         Idaho            2  +0 1567582    783791
Illinois        18  +0 12830632   712812         Indiana          9  +0 6483802    720422
Iowa             4  +0 3046355    761588         Kansas           4  +0 2853118    713279
Kentucky         6  +0 4339367    723227         Louisiana        6  +0 4533372    755562
Maine            2  +0 1328361    664180         Maryland         8  +0 5773552    721694
Massachusetts    9  +0 6547629    727514         Michigan        14  +0 9883640    705974
Minnesota        8  +0 5303925    662990         Mississippi      4  +0 2967297    741824
Missouri         8  +0 5988927    748615         Montana          1  +0 999243     999243
Nebraska         3  +0 1826341    608780         Nevada           4  +0 2700551    675137
NewHampshire     2  +0 1316470    658235         NewJersey       12  +0 8791894    732657
NewMexico        3  +0 2059179    686393         NewYork         27  +0 19378102   717707
No.MarinaIsl     0  +0 88662      0              NorthCarolina   13  +0 9535483    733498
NorthDakota      1  +0 672591     672591         Ohio            16  +0 11536504   721031
Oklahoma         5  +0 3751351    750270         Oregon           5  +0 3831074    766214
Pennsylvania    18  +0 12702379   705687         PuertoRico       0  +0 3725789    0
RhodeIsland      2  +0 1052567    526283         SouthCarolina    7  +0 4625364    660766
SouthDakota      1  +0 814180     814180         Tennessee        9  +0 6346105    705122
Texas           36  +0 25145561   698487         USTerritories    0  +0 442545     0
USVirgin         0  +0 109825     0              Utah             4  +0 2763885    690971
Vermont          1  +0 625741     625741         Virginia        11  +0 8001024    727365
Washington      10  +0 6724540    672454         WashingtonDC     0  +0 601723     0
WestVirginia     3  +0 1852994    617664         Wisconsin        8  +0 5686986    710873
Wyoming          1  +0 600456     600456

Represented Persons = 308532682, Total Seats = 435, US Ratio = 709270
Max is Montana at 999243,  Min is RhodeIsland at 526283
Max/Min = 1.899
Second, you can enter a ratio that all states would have to fall below. You can enter something like 30000, and it will apportion out the seats until every state is under the 30000 ratio. Based on our current census this comes to 10529 seats:

Code: Select all

State           Seats   Population Ratio          State           Seats   Population Ratio
Alabama        163 +156 4779736    29323          Alaska          24 +23  710231     29592
AmerSamoa        0 +0   65628      0              Arizona        218 +209 6392017    29321
Arkansas       100 +96  2915918    29159          California     1283 +1230 37593222   29301
Colorado       172 +165 5029196    29239          Connecticut    122 +117 3574097    29295
Delaware        31 +30  900877     29060          Florida        642 +615 18801310   29285
Georgia        331 +317 9687653    29267          Guam             0 +0   178430     0
Hawaii          46 +44  1360301    29571          Idaho           54 +52  1567582    29029
Illinois       438 +420 12830632   29293          Indiana        221 +212 6483802    29338
Iowa           104 +100 3046355    29291          Kansas          97 +93  2853118    29413
Kentucky       148 +142 4339367    29320          Louisiana      155 +149 4533372    29247
Maine           45 +43  1328361    29519          Maryland       197 +189 5773552    29307
Massachusetts  223 +214 6547629    29361          Michigan       337 +323 9883640    29328
Minnesota      181 +173 5303925    29303          Mississippi    101 +97  2967297    29379
Missouri       204 +196 5988927    29357          Montana         34 +33  999243     29389
Nebraska        62 +59  1826341    29457          Nevada          92 +88  2700551    29353
NewHampshire    45 +43  1316470    29254          NewJersey      300 +288 8791894    29306
NewMexico       70 +67  2059179    29416          NewYork        661 +634 19378102   29316
No.MarinaIsl     0 +0   88662      0              NorthCarolina  325 +312 9535483    29339
NorthDakota     23 +22  672591     29243          Ohio           394 +378 11536504   29280
Oklahoma       128 +123 3751351    29307          Oregon         131 +126 3831074    29244
Pennsylvania   434 +416 12702379   29268          PuertoRico       0 +0   3725789    0
RhodeIsland     36 +34  1052567    29237          SouthCarolina  158 +151 4625364    29274
SouthDakota     28 +27  814180     29077          Tennessee      217 +208 6346105    29244
Texas          858 +822 25145561   29307          USTerritories    0 +0   442545     0
USVirgin         0 +0   109825     0              Utah            94 +90  2763885    29403
Vermont         21 +20  625741     29797          Virginia       273 +262 8001024    29307
Washington     230 +220 6724540    29237          WashingtonDC     0 +0   601723     0
WestVirginia    63 +60  1852994    29412          Wisconsin      194 +186 5686986    29314
Wyoming         21 +20  600456     28593

Represented Persons = 308532682, Total Seats = 10529, US Ratio = 29303
Max is Vermont at 29797,  Min is Wyoming at 28593
Max/Min = 1.042
Thirdly, you can enter a Max/Min ratio which will keep adding seats until the Max ratio divided by the Min ratio is less than a certain number. Currently, Montana has 999,243 persons for their 1 representative while Rhode Island has 1,052,567 persons covered by 2 representatives. Montana's members have the least representation, while Rhode Island has the most. One citizen in Rhode Island has a value of 1.899 citizens in Montana. Now, it's not possible to reduce this to 1 without expanding the size of the house to the millions, however, you can get quite a bit closer to 1. In order to have a Max/Min of less than 1.6, you would need 759 seats (which actually gives you 1.51), less than 1.4 you would need 841 seats (which actually gives you 1.356), less than 1.2 you would need 1381 seats. It's interesting going by this, because in some cases increasing the seats can actually give you a worse max/min, such as when our 420th seat was added (Rhode Island #2), the max/min ratio went from 1.753 to 1.899. This function stops adding seats as soon as the max/min falls below the stated number.

Code: Select all

State           Seats   Population Ratio          State           Seats   Population Ratio
Alabama         21 +14  4779736    227606         Alaska           3 +2   710231     236743
AmerSamoa        0 +0   65628      0              Arizona         29 +20  6392017    220414
Arkansas        13 +9   2915918    224301         California     168 +115 37593222   223769
Colorado        23 +16  5029196    218660         Connecticut     16 +11  3574097    223381
Delaware         4 +3   900877     225219         Florida         84 +57  18801310   223825
Georgia         43 +29  9687653    225294         Guam             0 +0   178430     0
Hawaii           6 +4   1360301    226716         Idaho            7 +5   1567582    223940
Illinois        57 +39  12830632   225098         Indiana         29 +20  6483802    223579
Iowa            14 +10  3046355    217596         Kansas          13 +9   2853118    219470
Kentucky        19 +13  4339367    228387         Louisiana       20 +14  4533372    226668
Maine            6 +4   1328361    221393         Maryland        26 +18  5773552    222059
Massachusetts   29 +20  6547629    225780         Michigan        44 +30  9883640    224628
Minnesota       24 +16  5303925    220996         Mississippi     13 +9   2967297    228253
Missouri        27 +19  5988927    221812         Montana          5 +4   999243     199848
Nebraska         8 +5   1826341    228292         Nevada          12 +8   2700551    225045
NewHampshire     6 +4   1316470    219411         NewJersey       39 +27  8791894    225433
NewMexico        9 +6   2059179    228797         NewYork         87 +60  19378102   222736
No.MarinaIsl     0 +0   88662      0              NorthCarolina   43 +30  9535483    221755
NorthDakota      3 +2   672591     224197         Ohio            52 +36  11536504   221855
Oklahoma        17 +12  3751351    220667         Oregon          17 +12  3831074    225357
Pennsylvania    57 +39  12702379   222848         PuertoRico       0 +0   3725789    0
RhodeIsland      5 +3   1052567    210513         SouthCarolina   21 +14  4625364    220255
SouthDakota      4 +3   814180     203545         Tennessee       28 +19  6346105    226646
Texas          113 +77  25145561   222527         USTerritories    0 +0   442545     0
USVirgin         0 +0   109825     0              Utah            12 +8   2763885    230323
Vermont          3 +2   625741     208580         Virginia        36 +25  8001024    222250
Washington      30 +20  6724540    224151         WashingtonDC     0 +0   601723     0
WestVirginia     8 +5   1852994    231624         Wisconsin       25 +17  5686986    227479
Wyoming          3 +2   600456     200152

Represented Persons = 308532682, Total Seats = 1381, US Ratio = 223412
Max is Alaska at 236743,  Min is Montana at 199848
Max/Min = 1.185
Also, it has the capability of adding representation to our other territories. Here is how it would change with Puerto Rico and Washington DC being added, but remaining at 435 seats:

Code: Select all

State           Seats   Population Ratio          State           Seats   Population Ratio
Alabama          7 +0   4779736    682819         Alaska           1 +0   710231     710231
AmerSamoa        0 +0   65628      0              Arizona          9 +0   6392017    710224
Arkansas         4 +0   2915918    728979         California      52 -1   37593222   722946
Colorado         7 +0   5029196    718456         Connecticut      5 +0   3574097    714819
Delaware         1 +0   900877     900877         Florida         26 -1   18801310   723127
Georgia         14 +0   9687653    691975         Guam             0 +0   178430     0
Hawaii           2 +0   1360301    680150         Idaho            2 +0   1567582    783791
Illinois        18 +0   12830632   712812         Indiana          9 +0   6483802    720422
Iowa             4 +0   3046355    761588         Kansas           4 +0   2853118    713279
Kentucky         6 +0   4339367    723227         Louisiana        6 +0   4533372    755562
Maine            2 +0   1328361    664180         Maryland         8 +0   5773552    721694
Massachusetts    9 +0   6547629    727514         Michigan        14 +0   9883640    705974
Minnesota        7 -1   5303925    757703         Mississippi      4 +0   2967297    741824
Missouri         8 +0   5988927    748615         Montana          1 +0   999243     999243
Nebraska         3 +0   1826341    608780         Nevada           4 +0   2700551    675137
NewHampshire     2 +0   1316470    658235         NewJersey       12 +0   8791894    732657
NewMexico        3 +0   2059179    686393         NewYork         27 +0   19378102   717707
No.MarinaIsl     0 +0   88662      0              NorthCarolina   13 +0   9535483    733498
NorthDakota      1 +0   672591     672591         Ohio            16 +0   11536504   721031
Oklahoma         5 +0   3751351    750270         Oregon           5 +0   3831074    766214
Pennsylvania    18 +0   12702379   705687         PuertoRico       5 +5   3725789    745157
RhodeIsland      2 +0   1052567    526283         SouthCarolina    6 -1   4625364    770894
SouthDakota      1 +0   814180     814180         Tennessee        9 +0   6346105    705122
Texas           35 -1   25145561   718444         USTerritories    0 +0   442545     0
USVirgin         0 +0   109825     0              Utah             4 +0   2763885    690971
Vermont          1 +0   625741     625741         Virginia        11 +0   8001024    727365
Washington       9 -1   6724540    747171         WashingtonDC     1 +1   601723     601723
WestVirginia     3 +0   1852994    617664         Wisconsin        8 +0   5686986    710873
Wyoming          1 +0   600456     600456

Represented Persons = 312860194, Total Seats = 435, US Ratio = 719218
Max is Montana at 999243,  Min is RhodeIsland at 526283
Max/Min = 1.899
If anybody wants me to run a scenario, please let me know. The program is extremely fast. It does about 1000 seats per second, but once it gets past about 13000 seats it has a rounding issue. I could try to fix this, but none of the scenarios I've heard described would exceed this.

Re: Created a C Program

Posted: Thu Aug 04, 2011 6:08 pm
by JEQuidam
StriderV wrote:I've created a C program which automatically apportions the states based on entered criteria. ...
I wish I had that a couple of years ago!

I've already created a set of massive spreadsheets that calculates the apportionment for every house size between 200 and 10,000, and for every apportionment method. Believe me: Creating those spreadsheets was a b*tch. They're basically a brute force calculation, but only takes a few seconds. I've run and tested them many times, so it's easier for me to keep using them. That being said, I think it's really cool that you've created this and are putting it out there for others to use. I would love to see more math heads and programmers working on providing apportionment engines.

BTW, I wanted that full range of results (from 200 to 10,000 Representatives) in order to facilitate graphing and correlation analyses. The spreadsheet provides a single vector of solutions for every population scenario.

Re: Created a C Program

Posted: Fri Aug 05, 2011 11:06 am
by StriderV
Ok! Well, I also created this program as a way of improving my coding skills.

Also, when you start the program, you can choose which population data set to use. I have created several so far. 2000 census, 2010 census, 2010 estimate (which was based on 2000 census, you'd be surprised how different it is from what actually happened), 2020 estimate, and other estimates up to 2060 estimate.

In 2060, we will have 1,058,507 people per representative...

Re: Created a C Program

Posted: Sat Aug 06, 2011 8:23 am
by JEQuidam
StriderV wrote:(which was based on 2000 census, you'd be surprised how different it is from what actually happened)
If you are saying that your apportionment results are different than that actually implemented, then I know what is happening. The USCB provides two sets of population data which are slightly different. They do this for a good reason, but it creates a lot of confusion. One data set is residents only (what we normally think of as the census). This is the data used by each state to draw its congressional districts. The next data set also includes certain US residents living abroad (e.g., military personnel). This is used to actually calculate the apportionment of Representatives among the states. This way, if a particular state has a large number of its citizens overseas then they are not cheated out of their fair share of Representatives. There's a good chance you are using the residents-only data instead of the second data set.

For more data, check out the links on this page:
http://www.thirty-thousand.org/pages/QHA-01.htm

I've done this massive set of analyses on apportionment, some of which I've already published on-line, and some I'm still putting together. When I'm done it will explain all that, and more.

Re: Created a C Program

Posted: Fri Aug 12, 2011 1:09 pm
by StriderV
I'm attempting to run the program such that in each apportionment since the beginning, no state would lose a representative. Just to see what size it gets to...

Anyway, when I got to the census data for 1810, I noticed something that seems very incorrect. Compare Maryland and Massachusetts.

Massachusetts population, 472040. Assigned 20 seats.
Maryland population, 380546. Assigned 9 seats.

I can't fathom any mathematic way that this would have occurred! One thought is that I am looking at total numbers, and not numbers separated with slaves (as up until the 14th ammendment slaves only counted as 3/5 of a person). BUT, why then in the next census it is apportioned as follows:

Massachusetts population 523,287. Assigned 13 seats
Maryland population 407,350. Assigned 9 seats.

It seems as if the discrepancy fostered in the 3rd apportionment (but also existing to a lesser extend in previous apportionments) was fixed in the 4th apportionment. And, this is a long way away from the 14th ammendment! Some 40 years away.

Re: Created a C Program

Posted: Fri Aug 12, 2011 4:55 pm
by JEQuidam
StriderV wrote:Anyway, when I got to the census data for 1810, I noticed something that seems very incorrect.
Be sure to review all the data and information provided at the links on the bottom of the following pages:
  1. The "Historical Annual Population of the United States" page, in particular the data sets provided by Professor Margo J. Anderson;
  2. The "Size of the U. S. House of Representatives and its Constituent State Delegations" page; and finally
  3. the "Apportionment" page provides a ton of information.
The links above provide a goldmine of relevant data. Believe me, this is well covered ground. If you'll review that data you will likely find the source of your discrepancy. If you don't find the discrepancy after you've reviewed all that, then let me know and I'll help you figure it out.

Re: Created a C Program

Posted: Fri Aug 12, 2011 6:07 pm
by StriderV
Thanks. One of those spreadsheets shows the population numbers used in apportionment. The site even says they don't always match the census numbers. I find this odd. The case I was looking at, it was giving Massachusetts 700,745 population, even though the official census for that year is 472,040. I'm not certain, but I think somehow Maine was getting added to Massachusetts before it became a state? Either way, I am now using the data from that site as that makes the seats match up more accurately.