sapor 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Area Class Diagram.dia +0 -0
- data/Area Class Diagram.png +0 -0
- data/Class Diagram.dia +0 -0
- data/Class Diagram.png +0 -0
- data/Example-Catalonia.md +361 -0
- data/Example-Flanders.md +486 -0
- data/Example-Greece.md +25 -0
- data/Example-Oslo.md +678 -0
- data/Example-UnitedKingdom-Referendum.md +132 -0
- data/Examples.md +15 -0
- data/LICENSE +674 -0
- data/README.md +103 -0
- data/Rakefile +18 -0
- data/Technical Documentation.md +14 -0
- data/bin/create_installation_package.sh +49 -0
- data/bin/install.sh +45 -0
- data/bin/sapor.rb +24 -0
- data/bin/sapor.sh +106 -0
- data/data/hu/hungary-2014.txt +1680 -0
- data/data/hu/hungary_2014_screen_scraper.rb +48 -0
- data/data/hu/hungary_2014_to_psv.rb +80 -0
- data/data/hu/index-2014.txt +106 -0
- data/data/pl/2015-gl-lis-okr.csv +42 -0
- data/data/pl/poland_2015_to_psv.rb +79 -0
- data/data/pl/poland_2015_to_psv_with_ko_and_rsw.rb +94 -0
- data/data/pl/poland_2015_to_psv_with_ko_konf_kp_l_and_zp.rb +100 -0
- data/data/pl/poland_2015_to_psv_with_ko_sld_and_wi.rb +92 -0
- data/data/pl/poland_2015_to_psv_with_sld.rb +84 -0
- data/data/pl/poland_2015_to_psv_with_sld_and_wi.rb +85 -0
- data/data/uk/inject_ukip_2015_as_brexit_2019_in_2017.rb +54 -0
- data/data/uk/united_kingdom_2015.txt +651 -0
- data/data/uk/united_kingdom_2015_to_psv.rb +104 -0
- data/data/uk/united_kingdom_2017.txt +651 -0
- data/data/uk/united_kingdom_2017_to_psv.rb +104 -0
- data/data/uk/united_kingdom_2017_to_psv_with_brexit_and_chuk.rb +113 -0
- data/data/uk/united_kingdom_2017_to_psv_with_tig.rb +111 -0
- data/lib/sapor.rb +150 -0
- data/lib/sapor/binomials_cache.rb +45 -0
- data/lib/sapor/combinations_distribution.rb +222 -0
- data/lib/sapor/denominators.rb +67 -0
- data/lib/sapor/dichotomies.rb +138 -0
- data/lib/sapor/dichotomy.rb +164 -0
- data/lib/sapor/first_past_the_post.rb +82 -0
- data/lib/sapor/largest_remainder.rb +118 -0
- data/lib/sapor/log4r_logger.rb +49 -0
- data/lib/sapor/log_facade.rb +40 -0
- data/lib/sapor/multi_district_leveled_proportional.rb +64 -0
- data/lib/sapor/multi_district_proportional.rb +123 -0
- data/lib/sapor/multi_district_variable_threshold_proportional.rb +128 -0
- data/lib/sapor/number_formatter.rb +45 -0
- data/lib/sapor/options.rb +73 -0
- data/lib/sapor/poll.rb +286 -0
- data/lib/sapor/polychotomy.rb +200 -0
- data/lib/sapor/pseudorandom_multirange_enumerator.rb +87 -0
- data/lib/sapor/referendum_polychotomy.rb +165 -0
- data/lib/sapor/regional_data/area.rb +82 -0
- data/lib/sapor/regional_data/austria.rb +84 -0
- data/lib/sapor/regional_data/belgium-brussels-2014.psv +46 -0
- data/lib/sapor/regional_data/belgium-brussels-20190526.psv +33 -0
- data/lib/sapor/regional_data/belgium-flanders-2014.psv +80 -0
- data/lib/sapor/regional_data/belgium-flanders-20190526.psv +74 -0
- data/lib/sapor/regional_data/belgium-wallonia-2014.psv +114 -0
- data/lib/sapor/regional_data/belgium-wallonia-20190526.psv +93 -0
- data/lib/sapor/regional_data/belgium.rb +97 -0
- data/lib/sapor/regional_data/belgium_brussels.rb +62 -0
- data/lib/sapor/regional_data/belgium_flanders.rb +64 -0
- data/lib/sapor/regional_data/belgium_wallonia.rb +63 -0
- data/lib/sapor/regional_data/catalonia-2012-2015.psv +100 -0
- data/lib/sapor/regional_data/catalonia-2012.psv +87 -0
- data/lib/sapor/regional_data/catalonia-2015-jxcat.psv +68 -0
- data/lib/sapor/regional_data/catalonia-2015-no-jxsi.psv +68 -0
- data/lib/sapor/regional_data/catalonia-2015.psv +63 -0
- data/lib/sapor/regional_data/catalonia-jxcat.rb +109 -0
- data/lib/sapor/regional_data/catalonia-no-jxsi.rb +96 -0
- data/lib/sapor/regional_data/catalonia.rb +96 -0
- data/lib/sapor/regional_data/denmark-20150618-with-e-and-p.psv +164 -0
- data/lib/sapor/regional_data/denmark-20150618-with-e.psv +153 -0
- data/lib/sapor/regional_data/denmark-20150618-with-p.psv +153 -0
- data/lib/sapor/regional_data/denmark-20150618.psv +142 -0
- data/lib/sapor/regional_data/denmark.rb +128 -0
- data/lib/sapor/regional_data/denmark_with_e.rb +128 -0
- data/lib/sapor/regional_data/denmark_with_e_and_p.rb +128 -0
- data/lib/sapor/regional_data/denmark_with_p.rb +128 -0
- data/lib/sapor/regional_data/estonia.rb +88 -0
- data/lib/sapor/regional_data/european-union-great-britain-20140522-brexit-chuk.psv +172 -0
- data/lib/sapor/regional_data/european-union-great-britain-20140522.psv +146 -0
- data/lib/sapor/regional_data/european-union-great-britain-20190523.psv +141 -0
- data/lib/sapor/regional_data/european-union-ireland-2014-ia-ri-sd.psv +64 -0
- data/lib/sapor/regional_data/european-union-ireland-2014-ia-sd.psv +60 -0
- data/lib/sapor/regional_data/european-union-ireland-2014-ia.psv +56 -0
- data/lib/sapor/regional_data/european-union-ireland-2014-sd.psv +56 -0
- data/lib/sapor/regional_data/european-union-ireland-2014.psv +50 -0
- data/lib/sapor/regional_data/european-union-ireland-20190524-ia.psv +58 -0
- data/lib/sapor/regional_data/european-union-ireland-20190524.psv +52 -0
- data/lib/sapor/regional_data/european_union_27_austria.rb +76 -0
- data/lib/sapor/regional_data/european_union_27_croatia.rb +81 -0
- data/lib/sapor/regional_data/european_union_27_denmark.rb +77 -0
- data/lib/sapor/regional_data/european_union_27_estonia.rb +74 -0
- data/lib/sapor/regional_data/european_union_27_finland.rb +74 -0
- data/lib/sapor/regional_data/european_union_27_ireland.rb +96 -0
- data/lib/sapor/regional_data/european_union_27_ireland_with_ia.rb +97 -0
- data/lib/sapor/regional_data/european_union_27_italy.rb +84 -0
- data/lib/sapor/regional_data/european_union_27_netherlands.rb +81 -0
- data/lib/sapor/regional_data/european_union_27_poland.rb +84 -0
- data/lib/sapor/regional_data/european_union_27_romania.rb +78 -0
- data/lib/sapor/regional_data/european_union_27_slovakia.rb +80 -0
- data/lib/sapor/regional_data/european_union_27_spain.rb +82 -0
- data/lib/sapor/regional_data/european_union_27_sweden.rb +76 -0
- data/lib/sapor/regional_data/european_union_austria.rb +76 -0
- data/lib/sapor/regional_data/european_union_bulgaria.rb +81 -0
- data/lib/sapor/regional_data/european_union_croatia.rb +81 -0
- data/lib/sapor/regional_data/european_union_cyprus.rb +72 -0
- data/lib/sapor/regional_data/european_union_czech_republic.rb +82 -0
- data/lib/sapor/regional_data/european_union_denmark.rb +77 -0
- data/lib/sapor/regional_data/european_union_estonia.rb +74 -0
- data/lib/sapor/regional_data/european_union_finland.rb +74 -0
- data/lib/sapor/regional_data/european_union_flanders.rb +74 -0
- data/lib/sapor/regional_data/european_union_france.rb +84 -0
- data/lib/sapor/regional_data/european_union_france_2019.rb +84 -0
- data/lib/sapor/regional_data/european_union_french_community_of_belgium.rb +73 -0
- data/lib/sapor/regional_data/european_union_germany.rb +86 -0
- data/lib/sapor/regional_data/european_union_great_britain.rb +98 -0
- data/lib/sapor/regional_data/european_union_greece.rb +77 -0
- data/lib/sapor/regional_data/european_union_hungary.rb +76 -0
- data/lib/sapor/regional_data/european_union_ireland.rb +96 -0
- data/lib/sapor/regional_data/european_union_ireland_with_ia.rb +97 -0
- data/lib/sapor/regional_data/european_union_italy.rb +84 -0
- data/lib/sapor/regional_data/european_union_latvia.rb +81 -0
- data/lib/sapor/regional_data/european_union_lithuania.rb +80 -0
- data/lib/sapor/regional_data/european_union_luxembourg.rb +75 -0
- data/lib/sapor/regional_data/european_union_malta.rb +71 -0
- data/lib/sapor/regional_data/european_union_netherlands.rb +81 -0
- data/lib/sapor/regional_data/european_union_northern_ireland.rb +75 -0
- data/lib/sapor/regional_data/european_union_poland.rb +84 -0
- data/lib/sapor/regional_data/european_union_portugal.rb +75 -0
- data/lib/sapor/regional_data/european_union_romania.rb +78 -0
- data/lib/sapor/regional_data/european_union_slovakia.rb +81 -0
- data/lib/sapor/regional_data/european_union_slovenia.rb +85 -0
- data/lib/sapor/regional_data/european_union_spain.rb +82 -0
- data/lib/sapor/regional_data/european_union_sweden.rb +76 -0
- data/lib/sapor/regional_data/finland-20150419-with-sin.psv +224 -0
- data/lib/sapor/regional_data/finland-20150419.psv +212 -0
- data/lib/sapor/regional_data/finland.rb +107 -0
- data/lib/sapor/regional_data/finland_with_sin.rb +107 -0
- data/lib/sapor/regional_data/flanders-2014.psv +96 -0
- data/lib/sapor/regional_data/flanders-20190526.psv +87 -0
- data/lib/sapor/regional_data/flanders.rb +115 -0
- data/lib/sapor/regional_data/france.rb +38 -0
- data/lib/sapor/regional_data/greece.rb +92 -0
- data/lib/sapor/regional_data/hungary-2014.psv +2104 -0
- data/lib/sapor/regional_data/hungary.rb +116 -0
- data/lib/sapor/regional_data/iceland-20161029-midflokkurinn.psv +94 -0
- data/lib/sapor/regional_data/iceland-20161029.psv +88 -0
- data/lib/sapor/regional_data/iceland-20171028.psv +85 -0
- data/lib/sapor/regional_data/iceland.rb +133 -0
- data/lib/sapor/regional_data/latvia-20141004-kpv-p-par.psv +109 -0
- data/lib/sapor/regional_data/latvia-20141004-kpv-par.psv +103 -0
- data/lib/sapor/regional_data/latvia-20141004-kpv.psv +97 -0
- data/lib/sapor/regional_data/latvia-20141004.psv +89 -0
- data/lib/sapor/regional_data/latvia.rb +112 -0
- data/lib/sapor/regional_data/latvia_kpv.rb +112 -0
- data/lib/sapor/regional_data/latvia_kpv_p_par.rb +112 -0
- data/lib/sapor/regional_data/latvia_kpv_par.rb +112 -0
- data/lib/sapor/regional_data/luxembourg-20131020.psv +76 -0
- data/lib/sapor/regional_data/luxembourg.rb +82 -0
- data/lib/sapor/regional_data/netherlands.rb +108 -0
- data/lib/sapor/regional_data/norway.rb +425 -0
- data/lib/sapor/regional_data/norwegian_municipality.rb +68 -0
- data/lib/sapor/regional_data/poland-20151025-with-ko-and-l-without-n-po-r-and-zl.psv +321 -0
- data/lib/sapor/regional_data/poland-20151025-with-ko-konf-kp-l-and-zp-without-k-k15-n-pis-po-psl-r-and-zl.psv +280 -0
- data/lib/sapor/regional_data/poland-20151025-with-ko-sld-and-wi-without-n-po-and-zl.psv +403 -0
- data/lib/sapor/regional_data/poland-20151025-with-sld-and-wi-without-zl.psv +444 -0
- data/lib/sapor/regional_data/poland-20151025-with-sld-without-zl.psv +403 -0
- data/lib/sapor/regional_data/poland-20151025.psv +403 -0
- data/lib/sapor/regional_data/poland.rb +125 -0
- data/lib/sapor/regional_data/poland_with_ko_and_l_without_n_po_r_and_zl.rb +122 -0
- data/lib/sapor/regional_data/poland_with_ko_konf_kp_l_and_zp_without_k_k15_n_pis_po_psl_r_and_zl.rb +123 -0
- data/lib/sapor/regional_data/poland_with_ko_sld_and_wi_without_n_po_and_zl.rb +125 -0
- data/lib/sapor/regional_data/poland_with_sld_and_wi_without_zl.rb +126 -0
- data/lib/sapor/regional_data/poland_with_sld_without_zl.rb +126 -0
- data/lib/sapor/regional_data/portugal-20151004-with-a-and-ch-without-paf.psv +438 -0
- data/lib/sapor/regional_data/portugal-20151004-with-a-and-il-without-paf.psv +438 -0
- data/lib/sapor/regional_data/portugal-20151004-with-a-ch-and-il-without-paf.psv +461 -0
- data/lib/sapor/regional_data/portugal-20151004-with-a-without-paf.psv +415 -0
- data/lib/sapor/regional_data/portugal-20151004-with-ch-and-il-without-paf.psv +438 -0
- data/lib/sapor/regional_data/portugal-20151004-without-paf.psv +392 -0
- data/lib/sapor/regional_data/portugal-20151004.psv +370 -0
- data/lib/sapor/regional_data/portugal.rb +101 -0
- data/lib/sapor/regional_data/portugal_with_a_and_ch_without_paf.rb +92 -0
- data/lib/sapor/regional_data/portugal_with_a_and_il_without_paf.rb +92 -0
- data/lib/sapor/regional_data/portugal_with_a_ch_and_il_without_paf.rb +92 -0
- data/lib/sapor/regional_data/portugal_with_a_without_paf.rb +92 -0
- data/lib/sapor/regional_data/portugal_with_ch_and_il_without_paf.rb +92 -0
- data/lib/sapor/regional_data/portugal_without_paf.rb +92 -0
- data/lib/sapor/regional_data/slovakia.rb +81 -0
- data/lib/sapor/regional_data/slovenia.rb +114 -0
- data/lib/sapor/regional_data/spain-20160626.psv +619 -0
- data/lib/sapor/regional_data/spain.rb +136 -0
- data/lib/sapor/regional_data/sweden.rb +92 -0
- data/lib/sapor/regional_data/sweden_20140914.rb +89 -0
- data/lib/sapor/regional_data/united_kingdom-2015.psv +4358 -0
- data/lib/sapor/regional_data/united_kingdom-20170608-brexit-chuk.psv +5154 -0
- data/lib/sapor/regional_data/united_kingdom-20170608-brexit.psv +4521 -0
- data/lib/sapor/regional_data/united_kingdom-20170608-tig.psv +4529 -0
- data/lib/sapor/regional_data/united_kingdom-20170608.psv +3894 -0
- data/lib/sapor/regional_data/united_kingdom.rb +94 -0
- data/lib/sapor/regional_data/united_kingdom_with_brexit.rb +110 -0
- data/lib/sapor/regional_data/united_kingdom_with_brexit_and_chuk.rb +111 -0
- data/lib/sapor/regional_data/united_kingdom_with_tig.rb +111 -0
- data/lib/sapor/regional_data/utopia.rb +66 -0
- data/lib/sapor/regional_data/wallonia-2014.psv +101 -0
- data/lib/sapor/regional_data/wallonia-20190526.psv +88 -0
- data/lib/sapor/regional_data/wallonia.rb +112 -0
- data/lib/sapor/representatives_polychotomy.rb +338 -0
- data/lib/sapor/single_district_proportional.rb +75 -0
- data/sapor.gemspec +35 -0
- data/spec/integration/area_spec.rb +28 -0
- data/spec/integration/poll_spec.rb +112 -0
- data/spec/integration/sample.poll +8 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/unit/area_spec.rb +115 -0
- data/spec/unit/austria_spec.rb +76 -0
- data/spec/unit/belgium_brussels_spec.rb +58 -0
- data/spec/unit/belgium_flanders_spec.rb +62 -0
- data/spec/unit/belgium_spec.rb +26 -0
- data/spec/unit/belgium_wallonia_spec.rb +65 -0
- data/spec/unit/binomials_cache_spec.rb +34 -0
- data/spec/unit/catalonia_spec.rb +74 -0
- data/spec/unit/combinations_distribution_spec.rb +241 -0
- data/spec/unit/denmark_spec.rb +56 -0
- data/spec/unit/denmark_with_e_and_p_spec.rb +58 -0
- data/spec/unit/denmark_with_e_spec.rb +57 -0
- data/spec/unit/denmark_with_p_spec.rb +57 -0
- data/spec/unit/denominators_spec.rb +40 -0
- data/spec/unit/dichotomies_spec.rb +154 -0
- data/spec/unit/dichotomy_spec.rb +320 -0
- data/spec/unit/estonia_spec.rb +65 -0
- data/spec/unit/european_union_27_austria_spec.rb +61 -0
- data/spec/unit/european_union_27_croatia_spec.rb +60 -0
- data/spec/unit/european_union_27_denmark_spec.rb +62 -0
- data/spec/unit/european_union_27_estonia_spec.rb +94 -0
- data/spec/unit/european_union_27_finland_spec.rb +75 -0
- data/spec/unit/european_union_27_ireland_spec.rb +72 -0
- data/spec/unit/european_union_27_ireland_with_ia_spec.rb +74 -0
- data/spec/unit/european_union_27_italy_spec.rb +69 -0
- data/spec/unit/european_union_27_netherlands_spec.rb +81 -0
- data/spec/unit/european_union_27_poland_spec.rb +69 -0
- data/spec/unit/european_union_27_romania_spec.rb +67 -0
- data/spec/unit/european_union_27_slovakia_spec.rb +111 -0
- data/spec/unit/european_union_27_spain_spec.rb +130 -0
- data/spec/unit/european_union_27_sweden_spec.rb +89 -0
- data/spec/unit/european_union_austria_spec.rb +61 -0
- data/spec/unit/european_union_bulgaria_spec.rb +97 -0
- data/spec/unit/european_union_croatia_spec.rb +59 -0
- data/spec/unit/european_union_cyprus_spec.rb +65 -0
- data/spec/unit/european_union_czech_republic_spec.rb +125 -0
- data/spec/unit/european_union_denmark_spec.rb +61 -0
- data/spec/unit/european_union_estonia_spec.rb +93 -0
- data/spec/unit/european_union_finland_spec.rb +75 -0
- data/spec/unit/european_union_flanders_spec.rb +56 -0
- data/spec/unit/european_union_france_2019_spec.rb +73 -0
- data/spec/unit/european_union_france_spec.rb +73 -0
- data/spec/unit/european_union_french_community_of_belgium_spec.rb +61 -0
- data/spec/unit/european_union_germany_spec.rb +90 -0
- data/spec/unit/european_union_great_britain_spec.rb +87 -0
- data/spec/unit/european_union_greece_spec.rb +148 -0
- data/spec/unit/european_union_hungary_spec.rb +57 -0
- data/spec/unit/european_union_ireland_spec.rb +72 -0
- data/spec/unit/european_union_ireland_with_ia_spec.rb +74 -0
- data/spec/unit/european_union_italy_spec.rb +69 -0
- data/spec/unit/european_union_latvia_spec.rb +76 -0
- data/spec/unit/european_union_lithuania_spec.rb +68 -0
- data/spec/unit/european_union_luxembourg_spec.rb +63 -0
- data/spec/unit/european_union_malta_spec.rb +60 -0
- data/spec/unit/european_union_netherlands_spec.rb +81 -0
- data/spec/unit/european_union_northern_ireland_spec.rb +66 -0
- data/spec/unit/european_union_poland_spec.rb +69 -0
- data/spec/unit/european_union_portugal_spec.rb +77 -0
- data/spec/unit/european_union_romania_spec.rb +67 -0
- data/spec/unit/european_union_slovakia_spec.rb +111 -0
- data/spec/unit/european_union_slovenia_spec.rb +77 -0
- data/spec/unit/european_union_spain_spec.rb +129 -0
- data/spec/unit/european_union_sweden_spec.rb +89 -0
- data/spec/unit/finland_spec.rb +65 -0
- data/spec/unit/finland_with_sin_spec.rb +67 -0
- data/spec/unit/first_past_the_post_spec.rb +54 -0
- data/spec/unit/flanders_spec.rb +70 -0
- data/spec/unit/france_spec.rb +32 -0
- data/spec/unit/greece_spec.rb +118 -0
- data/spec/unit/hungary_spec.rb +132 -0
- data/spec/unit/iceland_spec.rb +57 -0
- data/spec/unit/largest_remainder_spec.rb +79 -0
- data/spec/unit/latvia_kpv_p_par_spec.rb +38 -0
- data/spec/unit/latvia_kpv_par_spec.rb +38 -0
- data/spec/unit/latvia_kpv_spec.rb +38 -0
- data/spec/unit/latvia_spec.rb +60 -0
- data/spec/unit/luxembourg_spec.rb +54 -0
- data/spec/unit/multi_district_leveled_proportional_spec.rb +49 -0
- data/spec/unit/multi_district_proportional_spec.rb +81 -0
- data/spec/unit/netherlands_spec.rb +107 -0
- data/spec/unit/norway_spec.rb +64 -0
- data/spec/unit/norwegian_municipality_spec.rb +89 -0
- data/spec/unit/number_formatter_spec.rb +173 -0
- data/spec/unit/poland_spec.rb +62 -0
- data/spec/unit/poland_with_ko_and_l_without_n_po_r_and_zl_spec.rb +60 -0
- data/spec/unit/poland_with_ko_konf_kp_l_and_zp_without_k_k15_n_pis_po_psl_r_and_zl_spec.rb +59 -0
- data/spec/unit/poland_with_ko_sld_and_wi_without_n_po_and_zl_spec.rb +62 -0
- data/spec/unit/poland_with_sld_and_wi_without_zl_spec.rb +63 -0
- data/spec/unit/poland_with_sld_without_zl_spec.rb +62 -0
- data/spec/unit/poll_spec.rb +110 -0
- data/spec/unit/portugal_spec.rb +66 -0
- data/spec/unit/portugal_with_a_and_ch_without_paf_spec.rb +68 -0
- data/spec/unit/portugal_with_a_and_il_without_paf_spec.rb +68 -0
- data/spec/unit/portugal_with_a_ch_and_il_without_paf_spec.rb +69 -0
- data/spec/unit/portugal_with_a_without_paf_spec.rb +67 -0
- data/spec/unit/portugal_with_ch_and_il_without_paf_spec.rb +68 -0
- data/spec/unit/portugal_without_paf_spec.rb +66 -0
- data/spec/unit/pseudorandom_multirange_enumerator_spec.rb +82 -0
- data/spec/unit/referendum_polychotomy_spec.rb +289 -0
- data/spec/unit/representatives_polychotomy_spec.rb +332 -0
- data/spec/unit/slovakia_spec.rb +99 -0
- data/spec/unit/slovenia_spec.rb +80 -0
- data/spec/unit/spain_spec.rb +101 -0
- data/spec/unit/sweden_20140914_spec.rb +112 -0
- data/spec/unit/sweden_spec.rb +113 -0
- data/spec/unit/united_kingdom_spec.rb +65 -0
- data/spec/unit/united_kingdom_with_brexit_and_chuk_spec.rb +67 -0
- data/spec/unit/united_kingdom_with_brexit_spec.rb +66 -0
- data/spec/unit/united_kingdom_with_tig_spec.rb +66 -0
- data/spec/unit/wallonia_spec.rb +70 -0
- metadata +490 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Statistical Analysis of Polling Results (SAPoR)
|
|
3
|
+
# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
|
|
4
|
+
#
|
|
5
|
+
# This file is part of SAPoR.
|
|
6
|
+
#
|
|
7
|
+
# SAPoR is free software: you can redistribute it and/or modify it under the
|
|
8
|
+
# terms of the GNU General Public License as published by the Free Software
|
|
9
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
|
10
|
+
# version.
|
|
11
|
+
#
|
|
12
|
+
# SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
13
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
14
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You can find a copy of the GNU General Public License in /doc/gpl.txt
|
|
17
|
+
#
|
|
18
|
+
|
|
19
|
+
module Sapor
|
|
20
|
+
#
|
|
21
|
+
# The regional data for Netherlands.
|
|
22
|
+
#
|
|
23
|
+
class Netherlands < Area
|
|
24
|
+
include Singleton
|
|
25
|
+
|
|
26
|
+
def area_code
|
|
27
|
+
'NL'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def coalitions
|
|
31
|
+
COALITIONS
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def no_of_seats
|
|
35
|
+
NO_OF_SEATS
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def population_size
|
|
39
|
+
POPULATION_SIZE
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def seats(simulation)
|
|
43
|
+
electoral_system.project(simulation)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def threshold
|
|
47
|
+
THRESHOLD
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
CDA_PARTY = 'Christen-Democratisch Appèl'.freeze
|
|
53
|
+
CU_PARTY = 'ChristenUnie'.freeze
|
|
54
|
+
D66_PARTY = 'Democraten 66'.freeze
|
|
55
|
+
FIFTY_PARTY = '50Plus'.freeze
|
|
56
|
+
FVD_PARTY = 'Forum voor Democratie'.freeze
|
|
57
|
+
GL_PARTY = 'GroenLinks'.freeze
|
|
58
|
+
PVDA_PARTY = 'Partij van de Arbeid'.freeze
|
|
59
|
+
PVV_PARTY = 'Partij voor de Vrijheid'.freeze
|
|
60
|
+
SGP_PARTY = 'Staatkundig Gereformeerde Partij'.freeze
|
|
61
|
+
SP_PARTY = 'Socialistische Partij'.freeze
|
|
62
|
+
VVD_PARTY = 'Volkspartij voor Vrijheid en Democratie'.freeze
|
|
63
|
+
|
|
64
|
+
COALITIONS = [[CDA_PARTY, CU_PARTY, D66_PARTY, GL_PARTY, PVDA_PARTY],
|
|
65
|
+
[CDA_PARTY, CU_PARTY, D66_PARTY, GL_PARTY, PVDA_PARTY,
|
|
66
|
+
SP_PARTY],
|
|
67
|
+
[CDA_PARTY, CU_PARTY, D66_PARTY, GL_PARTY, VVD_PARTY],
|
|
68
|
+
[CDA_PARTY, CU_PARTY, D66_PARTY, PVDA_PARTY, VVD_PARTY],
|
|
69
|
+
[CDA_PARTY, CU_PARTY, D66_PARTY, VVD_PARTY],
|
|
70
|
+
[CDA_PARTY, CU_PARTY, PVDA_PARTY],
|
|
71
|
+
[CDA_PARTY, D66_PARTY],
|
|
72
|
+
[CDA_PARTY, D66_PARTY, PVDA_PARTY],
|
|
73
|
+
[CDA_PARTY, D66_PARTY, VVD_PARTY],
|
|
74
|
+
[CDA_PARTY, FIFTY_PARTY, FVD_PARTY, VVD_PARTY],
|
|
75
|
+
[CDA_PARTY, FIFTY_PARTY, FVD_PARTY, VVD_PARTY, SGP_PARTY],
|
|
76
|
+
[CDA_PARTY, FVD_PARTY, PVV_PARTY, SGP_PARTY, VVD_PARTY],
|
|
77
|
+
[CDA_PARTY, FVD_PARTY, PVV_PARTY, VVD_PARTY],
|
|
78
|
+
[CDA_PARTY, FVD_PARTY, SGP_PARTY, VVD_PARTY],
|
|
79
|
+
[CDA_PARTY, FVD_PARTY, VVD_PARTY],
|
|
80
|
+
[CDA_PARTY, PVDA_PARTY],
|
|
81
|
+
[CDA_PARTY, PVDA_PARTY, VVD_PARTY],
|
|
82
|
+
[CDA_PARTY, PVV_PARTY, VVD_PARTY],
|
|
83
|
+
[CDA_PARTY, VVD_PARTY],
|
|
84
|
+
[D66_PARTY, PVDA_PARTY, VVD_PARTY],
|
|
85
|
+
[PVDA_PARTY, VVD_PARTY]].freeze
|
|
86
|
+
|
|
87
|
+
NO_OF_SEATS = 150
|
|
88
|
+
|
|
89
|
+
# Voter turnout on 21 March 2017
|
|
90
|
+
# Source: Web page with the official results of the elections of 21 March
|
|
91
|
+
# 2017, downloaded on 10 August 2019,
|
|
92
|
+
# https://nl.wikipedia.org/wiki/Tweede_Kamerverkiezingen_2017
|
|
93
|
+
POPULATION_SIZE = 10_516_041
|
|
94
|
+
|
|
95
|
+
THRESHOLD = 1 / NO_OF_SEATS.to_f
|
|
96
|
+
|
|
97
|
+
def electoral_system
|
|
98
|
+
if @electoral_system.nil?
|
|
99
|
+
@electoral_system = SingleDistrictProportional.new(
|
|
100
|
+
NO_OF_SEATS,
|
|
101
|
+
DhondtDenominators,
|
|
102
|
+
THRESHOLD
|
|
103
|
+
)
|
|
104
|
+
end
|
|
105
|
+
@electoral_system
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# Statistical Analysis of Polling Results (SAPoR)
|
|
4
|
+
# Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
|
|
5
|
+
#
|
|
6
|
+
# This file is part of SAPoR.
|
|
7
|
+
#
|
|
8
|
+
# SAPoR is free software: you can redistribute it and/or modify it under the
|
|
9
|
+
# terms of the GNU General Public License as published by the Free Software
|
|
10
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
|
11
|
+
# version.
|
|
12
|
+
#
|
|
13
|
+
# SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
14
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
15
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You can find a copy of the GNU General Public License in /doc/gpl.txt
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
module Sapor
|
|
21
|
+
#
|
|
22
|
+
# The regional data for Norway.
|
|
23
|
+
#
|
|
24
|
+
class Norway < Area
|
|
25
|
+
include Singleton
|
|
26
|
+
|
|
27
|
+
# Source: NSD European Election Database, Parliamentary election of 2013,
|
|
28
|
+
# retrieved on 14 April 2015.
|
|
29
|
+
# URL: http://eed.nsd.uib.no/webview/index.jsp?stubs=nuts_id&study=http%3A%2F%2F129.177.90.166%3A80%2Fobj%2FfStudy%2Fnopa2013&virtualslice=pv_p_value&measuretype=4&headers=party_name_org&mode=cube&v=2&party_name_orgsubset=1+-+9&cube=http%3A%2F%2F129.177.90.166%3A80%2Fobj%2FfCube%2Fnopa2013_C1&nuts_idsubset=NO%2CNO011+-+NO073&virtualsubset=pv_p_value&layers=virtual&measure=common&top=yes
|
|
30
|
+
LAST_DETAILED_ELECTION_RESULT = {
|
|
31
|
+
'Akershus' => { 'Arbeiderpartiet' => 91_364,
|
|
32
|
+
'Høyre' => 108_860,
|
|
33
|
+
'Fremskrittspartiet' => 54_658,
|
|
34
|
+
'Kristelig Folkeparti' => 10_377,
|
|
35
|
+
'Senterpartiet' => 8_111,
|
|
36
|
+
'Venstre' => 20_217,
|
|
37
|
+
'Sosialistisk Venstreparti' => 11_305,
|
|
38
|
+
'Miljøpartiet de Grønne' => 9_804,
|
|
39
|
+
'Rødt' => 2_365,
|
|
40
|
+
'De Kristne' => 792,
|
|
41
|
+
'Pensjonistpartiet' => 1_557,
|
|
42
|
+
'Piratpartiet' => 1_106,
|
|
43
|
+
'Kystpartiet' => 149,
|
|
44
|
+
'Demokratene i Norge' => 115,
|
|
45
|
+
'Kristent Samlingsparti' => 197,
|
|
46
|
+
'Det Liberale Folkepartiet' => 195,
|
|
47
|
+
'Samfunnspartiet' => 77 },
|
|
48
|
+
'Aust-Agder' => { 'Arbeiderpartiet' => 17_623,
|
|
49
|
+
'Høyre' => 16_303,
|
|
50
|
+
'Fremskrittspartiet' => 11_278,
|
|
51
|
+
'Kristelig Folkeparti' => 7_019,
|
|
52
|
+
'Senterpartiet' => 2_815,
|
|
53
|
+
'Venstre' => 3_033,
|
|
54
|
+
'Sosialistisk Venstreparti' => 1_652,
|
|
55
|
+
'Miljøpartiet de Grønne' => 1_242,
|
|
56
|
+
'Rødt' => 345,
|
|
57
|
+
'De Kristne' => 862,
|
|
58
|
+
'Pensjonistpartiet' => 354,
|
|
59
|
+
'Piratpartiet' => 176,
|
|
60
|
+
'Kystpartiet' => 35,
|
|
61
|
+
'Demokratene i Norge' => 46,
|
|
62
|
+
'Kristent Samlingsparti' => 117 },
|
|
63
|
+
'Buskerud' => { 'Arbeiderpartiet' => 47_572,
|
|
64
|
+
'Høyre' => 43_515,
|
|
65
|
+
'Fremskrittspartiet' => 27_854,
|
|
66
|
+
'Kristelig Folkeparti' => 4_863,
|
|
67
|
+
'Senterpartiet' => 9_110,
|
|
68
|
+
'Venstre' => 6_913,
|
|
69
|
+
'Sosialistisk Venstreparti' => 4_094,
|
|
70
|
+
'Miljøpartiet de Grønne' => 3_345,
|
|
71
|
+
'Rødt' => 905,
|
|
72
|
+
'De Kristne' => 736,
|
|
73
|
+
'Piratpartiet' => 508,
|
|
74
|
+
'Kystpartiet' => 135,
|
|
75
|
+
'Demokratene i Norge' => 80,
|
|
76
|
+
'Kristent Samlingsparti' => 125,
|
|
77
|
+
'Samfunnspartiet' => 56 },
|
|
78
|
+
'Finnmark' => { 'Arbeiderpartiet' => 15_003,
|
|
79
|
+
'Høyre' => 8_032,
|
|
80
|
+
'Fremskrittspartiet' => 6_038,
|
|
81
|
+
'Kristelig Folkeparti' => 1_117,
|
|
82
|
+
'Senterpartiet' => 1_403,
|
|
83
|
+
'Venstre' => 1_359,
|
|
84
|
+
'Sosialistisk Venstreparti' => 1_952,
|
|
85
|
+
'Miljøpartiet de Grønne' => 844,
|
|
86
|
+
'Rødt' => 351,
|
|
87
|
+
'De Kristne' => 335,
|
|
88
|
+
'Piratpartiet' => 144,
|
|
89
|
+
'Kystpartiet' => 550,
|
|
90
|
+
'Demokratene i Norge' => 23,
|
|
91
|
+
'Kristent Samlingsparti' => 41,
|
|
92
|
+
'Sykehus til Alta' => 467 },
|
|
93
|
+
'Hedmark' => { 'Arbeiderpartiet' => 48_694,
|
|
94
|
+
'Høyre' => 20_600,
|
|
95
|
+
'Fremskrittspartiet' => 15_316,
|
|
96
|
+
'Kristelig Folkeparti' => 2_871,
|
|
97
|
+
'Senterpartiet' => 11_483,
|
|
98
|
+
'Venstre' => 3_805,
|
|
99
|
+
'Sosialistisk Venstreparti' => 4_393,
|
|
100
|
+
'Miljøpartiet de Grønne' => 2_224,
|
|
101
|
+
'Rødt' => 773,
|
|
102
|
+
'De Kristne' => 414,
|
|
103
|
+
'Pensjonistpartiet' => 1_719,
|
|
104
|
+
'Piratpartiet' => 311,
|
|
105
|
+
'Kystpartiet' => 57,
|
|
106
|
+
'Demokratene i Norge' => 63 },
|
|
107
|
+
'Hordaland' => { 'Arbeiderpartiet' => 71_216,
|
|
108
|
+
'Høyre' => 89_682,
|
|
109
|
+
'Fremskrittspartiet' => 43_357,
|
|
110
|
+
'Kristelig Folkeparti' => 22_114,
|
|
111
|
+
'Senterpartiet' => 12_490,
|
|
112
|
+
'Venstre' => 16_614,
|
|
113
|
+
'Sosialistisk Venstreparti' => 14_143,
|
|
114
|
+
'Miljøpartiet de Grønne' => 9_171,
|
|
115
|
+
'Rødt' => 2_687,
|
|
116
|
+
'De Kristne' => 2_422,
|
|
117
|
+
'Pensjonistpartiet' => 631,
|
|
118
|
+
'Piratpartiet' => 1_062,
|
|
119
|
+
'Kystpartiet' => 267,
|
|
120
|
+
'Demokratene i Norge' => 275,
|
|
121
|
+
'Norges Kommunistiske Parti' => 127,
|
|
122
|
+
'Folkemakten' => 175 },
|
|
123
|
+
'Møre og Romsdal' => { 'Arbeiderpartiet' => 36_048,
|
|
124
|
+
'Høyre' => 37_594,
|
|
125
|
+
'Fremskrittspartiet' => 28_746,
|
|
126
|
+
'Kristelig Folkeparti' => 12_786,
|
|
127
|
+
'Senterpartiet' => 11_749,
|
|
128
|
+
'Venstre' => 7_965,
|
|
129
|
+
'Sosialistisk Venstreparti' => 3_532,
|
|
130
|
+
'Miljøpartiet de Grønne' => 1_963,
|
|
131
|
+
'Rødt' => 642,
|
|
132
|
+
'De Kristne' => 1_534,
|
|
133
|
+
'Piratpartiet' => 479,
|
|
134
|
+
'Kystpartiet' => 159,
|
|
135
|
+
'Demokratene i Norge' => 94 },
|
|
136
|
+
'Nord-Trøndelag' => { 'Arbeiderpartiet' => 32_054,
|
|
137
|
+
'Høyre' => 11_128,
|
|
138
|
+
'Fremskrittspartiet' => 9_869,
|
|
139
|
+
'Kristelig Folkeparti' => 2_707,
|
|
140
|
+
'Senterpartiet' => 12_796,
|
|
141
|
+
'Venstre' => 3_158,
|
|
142
|
+
'Sosialistisk Venstreparti' => 2_596,
|
|
143
|
+
'Miljøpartiet de Grønne' => 1_051,
|
|
144
|
+
'Rødt' => 423,
|
|
145
|
+
'De Kristne' => 283,
|
|
146
|
+
'Piratpartiet' => 209,
|
|
147
|
+
'Kystpartiet' => 81,
|
|
148
|
+
'Demokratene i Norge' => 38,
|
|
149
|
+
'Kristent Samlingsparti' => 107 },
|
|
150
|
+
'Nordland' => { 'Arbeiderpartiet' => 46_743,
|
|
151
|
+
'Høyre' => 28_271,
|
|
152
|
+
'Fremskrittspartiet' => 25_020,
|
|
153
|
+
'Kristelig Folkeparti' => 4_886,
|
|
154
|
+
'Senterpartiet' => 9_237,
|
|
155
|
+
'Venstre' => 4_938,
|
|
156
|
+
'Sosialistisk Venstreparti' => 6_907,
|
|
157
|
+
'Miljøpartiet de Grønne' => 2_653,
|
|
158
|
+
'Rødt' => 2_164,
|
|
159
|
+
'De Kristne' => 698,
|
|
160
|
+
'Pensjonistpartiet' => 416,
|
|
161
|
+
'Piratpartiet' => 451,
|
|
162
|
+
'Kystpartiet' => 424,
|
|
163
|
+
'Demokratene i Norge' => 60,
|
|
164
|
+
'Norges Kommunistiske Parti' => 58,
|
|
165
|
+
'Samfunnspartiet' => 92,
|
|
166
|
+
'Folkeliste mot oljeboring i Lofoten, Vesterålen og' \
|
|
167
|
+
' Senja' => 268 },
|
|
168
|
+
'Oppland' => { 'Arbeiderpartiet' => 44_050,
|
|
169
|
+
'Høyre' => 20_537,
|
|
170
|
+
'Fremskrittspartiet' => 13_683,
|
|
171
|
+
'Kristelig Folkeparti' => 3_418,
|
|
172
|
+
'Senterpartiet' => 13_162,
|
|
173
|
+
'Venstre' => 4_248,
|
|
174
|
+
'Sosialistisk Venstreparti' => 3_165,
|
|
175
|
+
'Miljøpartiet de Grønne' => 2_583,
|
|
176
|
+
'Rødt' => 817,
|
|
177
|
+
'De Kristne' => 460,
|
|
178
|
+
'Pensjonistpartiet' => 802,
|
|
179
|
+
'Piratpartiet' => 298,
|
|
180
|
+
'Kystpartiet' => 74,
|
|
181
|
+
'Demokratene i Norge' => 54,
|
|
182
|
+
'Det Liberale Folkepartiet' => 58 },
|
|
183
|
+
'Oslo' => { 'Arbeiderpartiet' => 106_001,
|
|
184
|
+
'Høyre' => 103_834,
|
|
185
|
+
'Fremskrittspartiet' => 40_660,
|
|
186
|
+
'Kristelig Folkeparti' => 9_850,
|
|
187
|
+
'Senterpartiet' => 2_963,
|
|
188
|
+
'Venstre' => 28_619,
|
|
189
|
+
'Sosialistisk Venstreparti' => 21_924,
|
|
190
|
+
'Miljøpartiet de Grønne' => 19_356,
|
|
191
|
+
'Rødt' => 11_133,
|
|
192
|
+
'De Kristne' => 734,
|
|
193
|
+
'Pensjonistpartiet' => 1_172,
|
|
194
|
+
'Piratpartiet' => 1_357,
|
|
195
|
+
'Kystpartiet' => 126,
|
|
196
|
+
'Demokratene i Norge' => 236,
|
|
197
|
+
'Kristent Samlingsparti' => 97,
|
|
198
|
+
'Det Liberale Folkepartiet' => 267,
|
|
199
|
+
'Norges Kommunistiske Parti' => 143,
|
|
200
|
+
'Samfunnspartiet' => 70 },
|
|
201
|
+
'Rogaland' => { 'Arbeiderpartiet' => 54_462,
|
|
202
|
+
'Høyre' => 72_470,
|
|
203
|
+
'Fremskrittspartiet' => 45_082,
|
|
204
|
+
'Kristelig Folkeparti' => 25_585,
|
|
205
|
+
'Senterpartiet' => 12_621,
|
|
206
|
+
'Venstre' => 10_827,
|
|
207
|
+
'Sosialistisk Venstreparti' => 7_908,
|
|
208
|
+
'Miljøpartiet de Grønne' => 5_267,
|
|
209
|
+
'Rødt' => 1_060,
|
|
210
|
+
'De Kristne' => 2_296,
|
|
211
|
+
'Pensjonistpartiet' => 1_191,
|
|
212
|
+
'Piratpartiet' => 865,
|
|
213
|
+
'Kystpartiet' => 202,
|
|
214
|
+
'Demokratene i Norge' => 115,
|
|
215
|
+
'Kristent Samlingsparti' => 351,
|
|
216
|
+
'Det Liberale Folkepartiet' => 226,
|
|
217
|
+
'Norges Kommunistiske Parti' => 67 },
|
|
218
|
+
'Sogn og Fjordane' => { 'Arbeiderpartiet' => 17_183,
|
|
219
|
+
'Høyre' => 11_635,
|
|
220
|
+
'Fremskrittspartiet' => 6_608,
|
|
221
|
+
'Kristelig Folkeparti' => 4_952,
|
|
222
|
+
'Senterpartiet' => 12_619,
|
|
223
|
+
'Venstre' => 3_883,
|
|
224
|
+
'Sosialistisk Venstreparti' => 2_076,
|
|
225
|
+
'Miljøpartiet de Grønne' => 1_032,
|
|
226
|
+
'Rødt' => 386,
|
|
227
|
+
'De Kristne' => 515,
|
|
228
|
+
'Piratpartiet' => 151,
|
|
229
|
+
'Kystpartiet' => 100,
|
|
230
|
+
'Demokratene i Norge' => 32 },
|
|
231
|
+
'Sør-Trøndelag' => { 'Arbeiderpartiet' => 64_351,
|
|
232
|
+
'Høyre' => 38_930,
|
|
233
|
+
'Fremskrittspartiet' => 23_871,
|
|
234
|
+
'Kristelig Folkeparti' => 6_562,
|
|
235
|
+
'Senterpartiet' => 11_351,
|
|
236
|
+
'Venstre' => 9_460,
|
|
237
|
+
'Sosialistisk Venstreparti' => 9_992,
|
|
238
|
+
'Miljøpartiet de Grønne' => 5_540,
|
|
239
|
+
'Rødt' => 1_667,
|
|
240
|
+
'De Kristne' => 522,
|
|
241
|
+
'Pensjonistpartiet' => 1_590,
|
|
242
|
+
'Piratpartiet' => 857,
|
|
243
|
+
'Kystpartiet' => 139,
|
|
244
|
+
'Demokratene i Norge' => 210,
|
|
245
|
+
'Kristent Samlingsparti' => 129,
|
|
246
|
+
'Det Liberale Folkepartiet' => 98,
|
|
247
|
+
'Norges Kommunistiske Parti' => 97 },
|
|
248
|
+
'Telemark' => { 'Arbeiderpartiet' => 35_963,
|
|
249
|
+
'Høyre' => 21_300,
|
|
250
|
+
'Fremskrittspartiet' => 18_564,
|
|
251
|
+
'Kristelig Folkeparti' => 6_610,
|
|
252
|
+
'Senterpartiet' => 4_360,
|
|
253
|
+
'Venstre' => 3_393,
|
|
254
|
+
'Sosialistisk Venstreparti' => 3_192,
|
|
255
|
+
'Miljøpartiet de Grønne' => 2_116,
|
|
256
|
+
'Rødt' => 884,
|
|
257
|
+
'De Kristne' => 1_017,
|
|
258
|
+
'Piratpartiet' => 239,
|
|
259
|
+
'Kystpartiet' => 68,
|
|
260
|
+
'Demokratene i Norge' => 56,
|
|
261
|
+
'Kristent Samlingsparti' => 116 },
|
|
262
|
+
'Troms' => { 'Arbeiderpartiet' => 27_436,
|
|
263
|
+
'Høyre' => 19_663,
|
|
264
|
+
'Fremskrittspartiet' => 17_315,
|
|
265
|
+
'Kristelig Folkeparti' => 3_659,
|
|
266
|
+
'Senterpartiet' => 5_636,
|
|
267
|
+
'Venstre' => 3_687,
|
|
268
|
+
'Sosialistisk Venstreparti' => 5_688,
|
|
269
|
+
'Miljøpartiet de Grønne' => 2_190,
|
|
270
|
+
'Rødt' => 1_608,
|
|
271
|
+
'De Kristne' => 322,
|
|
272
|
+
'Piratpartiet' => 382,
|
|
273
|
+
'Kystpartiet' => 477,
|
|
274
|
+
'Demokratene i Norge' => 37,
|
|
275
|
+
'Kristent Samlingsparti' => 92,
|
|
276
|
+
'Norges Kommunistiske Parti' => 78 },
|
|
277
|
+
'Vest-Agder' => { 'Arbeiderpartiet' => 23_227,
|
|
278
|
+
'Høyre' => 26_818,
|
|
279
|
+
'Fremskrittspartiet' => 17_863,
|
|
280
|
+
'Kristelig Folkeparti' => 13_536,
|
|
281
|
+
'Senterpartiet' => 2_962,
|
|
282
|
+
'Venstre' => 4_205,
|
|
283
|
+
'Sosialistisk Venstreparti' => 2_568,
|
|
284
|
+
'Miljøpartiet de Grønne' => 2_196,
|
|
285
|
+
'Rødt' => 460,
|
|
286
|
+
'De Kristne' => 1_975,
|
|
287
|
+
'Pensjonistpartiet' => 881,
|
|
288
|
+
'Piratpartiet' => 284,
|
|
289
|
+
'Kystpartiet' => 43,
|
|
290
|
+
'Demokratene i Norge' => 516,
|
|
291
|
+
'Det Liberale Folkepartiet' => 65,
|
|
292
|
+
'Norges Kommunistiske Parti' => 41 },
|
|
293
|
+
'Vestfold' => { 'Arbeiderpartiet' => 40_869,
|
|
294
|
+
'Høyre' => 41_357,
|
|
295
|
+
'Fremskrittspartiet' => 26_977,
|
|
296
|
+
'Kristelig Folkeparti' => 6_735,
|
|
297
|
+
'Senterpartiet' => 4_084,
|
|
298
|
+
'Venstre' => 6_228,
|
|
299
|
+
'Sosialistisk Venstreparti' => 5_266,
|
|
300
|
+
'Miljøpartiet de Grønne' => 3_407,
|
|
301
|
+
'Rødt' => 932,
|
|
302
|
+
'De Kristne' => 691,
|
|
303
|
+
'Pensjonistpartiet' => 596,
|
|
304
|
+
'Piratpartiet' => 474,
|
|
305
|
+
'Kystpartiet' => 157,
|
|
306
|
+
'Demokratene i Norge' => 65,
|
|
307
|
+
'Kristent Samlingsparti' => 205 },
|
|
308
|
+
'Østfold' => { 'Arbeiderpartiet' => 54_910,
|
|
309
|
+
'Høyre' => 39_703,
|
|
310
|
+
'Fremskrittspartiet' => 30_801,
|
|
311
|
+
'Kristelig Folkeparti' => 8_828,
|
|
312
|
+
'Senterpartiet' => 6_405,
|
|
313
|
+
'Venstre' => 5_723,
|
|
314
|
+
'Sosialistisk Venstreparti' => 3_668,
|
|
315
|
+
'Miljøpartiet de Grønne' => 3_168,
|
|
316
|
+
'Rødt' => 1_149,
|
|
317
|
+
'De Kristne' => 1_123,
|
|
318
|
+
'Pensjonistpartiet' => 956,
|
|
319
|
+
'Piratpartiet' => 516,
|
|
320
|
+
'Kystpartiet' => 68,
|
|
321
|
+
'Demokratene i Norge' => 99,
|
|
322
|
+
'Kristent Samlingsparti' => 145 }
|
|
323
|
+
}.freeze
|
|
324
|
+
|
|
325
|
+
def area_code
|
|
326
|
+
'NO'
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
def coalitions
|
|
330
|
+
COALITIONS
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
def no_of_seats
|
|
334
|
+
NO_OF_SEATS
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
def overall_election_results_of_2015
|
|
338
|
+
if @overall_election_results_of_2015.nil?
|
|
339
|
+
@overall_election_results_of_2015 = \
|
|
340
|
+
summarize_election_results(election_results_of_2015)
|
|
341
|
+
end
|
|
342
|
+
@overall_election_results_of_2015
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
def population_size
|
|
346
|
+
# Source: NSD European Election Database, Norway, retrieved on 14 April
|
|
347
|
+
# 2015.
|
|
348
|
+
# URL: http://www.nsd.uib.no/european_election_database/country/norway/
|
|
349
|
+
2_836_029
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def seats(simulation)
|
|
353
|
+
electoral_system.project(simulation)
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
def threshold
|
|
357
|
+
LEVELING_THRESHOLD
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
private
|
|
361
|
+
|
|
362
|
+
COALITIONS = [['Arbeiderpartiet', 'Kristelig Folkeparti', 'Senterpartiet'],
|
|
363
|
+
['Arbeiderpartiet', 'Kristelig Folkeparti',
|
|
364
|
+
'Miljøpartiet de Grønne', 'Senterpartiet',
|
|
365
|
+
'Sosialistisk Venstreparti'],
|
|
366
|
+
['Arbeiderpartiet', 'Miljøpartiet de Grønne', 'Rødt',
|
|
367
|
+
'Senterpartiet', 'Sosialistisk Venstreparti'],
|
|
368
|
+
['Arbeiderpartiet', 'Miljøpartiet de Grønne', 'Senterpartiet',
|
|
369
|
+
'Sosialistisk Venstreparti'],
|
|
370
|
+
['Arbeiderpartiet', 'Rødt', 'Senterpartiet',
|
|
371
|
+
'Sosialistisk Venstreparti'],
|
|
372
|
+
['Arbeiderpartiet', 'Senterpartiet',
|
|
373
|
+
'Sosialistisk Venstreparti'],
|
|
374
|
+
%w(Arbeiderpartiet Senterpartiet),
|
|
375
|
+
['Arbeiderpartiet', 'Sosialistisk Venstreparti'],
|
|
376
|
+
%w(Fremskrittspartiet Høyre),
|
|
377
|
+
['Fremskrittspartiet', 'Høyre', 'Kristelig Folkeparti',
|
|
378
|
+
'Miljøpartiet de Grønne', 'Venstre'],
|
|
379
|
+
['Fremskrittspartiet', 'Høyre', 'Kristelig Folkeparti',
|
|
380
|
+
'Senterpartiet', 'Venstre'],
|
|
381
|
+
['Fremskrittspartiet', 'Høyre', 'Kristelig Folkeparti',
|
|
382
|
+
'Venstre'],
|
|
383
|
+
['Høyre', 'Kristelig Folkeparti', 'Venstre'],
|
|
384
|
+
['Kristelig Folkeparti', 'Senterpartiet', 'Venstre']].freeze
|
|
385
|
+
|
|
386
|
+
# Source: Valg i Norge, Valgkretser, Wikipedia, retrieved on 1 May 2015.
|
|
387
|
+
# URL: http://no.wikipedia.org/wiki/Valg_i_Norge#Valgkretser
|
|
388
|
+
DIRECT_SEAT_DISTRIBUTION = { 'Akershus' => 16, 'Aust-Agder' => 3,
|
|
389
|
+
'Buskerud' => 8, 'Finnmark' => 4,
|
|
390
|
+
'Hedmark' => 6, 'Hordaland' => 15,
|
|
391
|
+
'Møre og Romsdal' => 8, 'Nord-Trøndelag' => 4,
|
|
392
|
+
'Nordland' => 8, 'Oppland' => 6, 'Oslo' => 18,
|
|
393
|
+
'Rogaland' => 13, 'Sogn og Fjordane' => 3,
|
|
394
|
+
'Sør-Trøndelag' => 9, 'Telemark' => 5,
|
|
395
|
+
'Troms' => 5, 'Vest-Agder' => 5,
|
|
396
|
+
'Vestfold' => 6, 'Østfold' => 8 }.freeze
|
|
397
|
+
|
|
398
|
+
LEVELING_THRESHOLD = 0.04
|
|
399
|
+
|
|
400
|
+
# Source: Valg i Norge, Valgkretser, Wikipedia, retrieved on 16 April 2015.
|
|
401
|
+
# URL: http://no.wikipedia.org/wiki/Valg_i_Norge#Valgkretser
|
|
402
|
+
NO_OF_LEVELING_SEATS = 19
|
|
403
|
+
|
|
404
|
+
NO_OF_SEATS = NO_OF_LEVELING_SEATS + \
|
|
405
|
+
DIRECT_SEAT_DISTRIBUTION.values.inject(:+)
|
|
406
|
+
|
|
407
|
+
def election_results_of_2015
|
|
408
|
+
if @election_results_of_2015.nil?
|
|
409
|
+
@election_results_of_2015 = LAST_DETAILED_ELECTION_RESULT
|
|
410
|
+
end
|
|
411
|
+
@election_results_of_2015
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
def electoral_system
|
|
415
|
+
if @electoral_system.nil?
|
|
416
|
+
@electoral_system = MultiDistrictLeveledProportional.new(
|
|
417
|
+
overall_election_results_of_2015, election_results_of_2015,
|
|
418
|
+
DIRECT_SEAT_DISTRIBUTION, NO_OF_LEVELING_SEATS, LEVELING_THRESHOLD,
|
|
419
|
+
SainteLague14Denominators
|
|
420
|
+
)
|
|
421
|
+
end
|
|
422
|
+
@electoral_system
|
|
423
|
+
end
|
|
424
|
+
end
|
|
425
|
+
end
|