sapor 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- 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/ie/2016-04-28_general-election-2016-candidate-details-csv_en.csv +552 -0
- data/data/ie/ireland_2016_to_psv.rb +138 -0
- data/data/no/2020-01-01_partifordeling_1_st_2017.csv +335 -0
- data/data/no/norway_2017_to_psv.rb +61 -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 +147 -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/many_past_the_post.rb +113 -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 +282 -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 +100 -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-20171221-with-vox.psv +67 -0
- data/lib/sapor/regional_data/catalonia-20171221.psv +61 -0
- data/lib/sapor/regional_data/catalonia.rb +124 -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 +83 -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_france.rb +84 -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 +82 -0
- data/lib/sapor/regional_data/european_union_croatia.rb +83 -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_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-with-j.psv +94 -0
- data/lib/sapor/regional_data/iceland-20171028.psv +85 -0
- data/lib/sapor/regional_data/iceland.rb +149 -0
- data/lib/sapor/regional_data/ireland-20160226-2020-candidates.psv +322 -0
- data/lib/sapor/regional_data/ireland-20160226-2020.psv +344 -0
- data/lib/sapor/regional_data/ireland-20160226.psv +348 -0
- data/lib/sapor/regional_data/ireland.rb +165 -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-20181006.psv +104 -0
- data/lib/sapor/regional_data/latvia.rb +111 -0
- data/lib/sapor/regional_data/luxembourg-20131020.psv +60 -0
- data/lib/sapor/regional_data/luxembourg-20181014.psv +59 -0
- data/lib/sapor/regional_data/luxembourg.rb +88 -0
- data/lib/sapor/regional_data/netherlands.rb +108 -0
- data/lib/sapor/regional_data/norway-20170911.psv +331 -0
- data/lib/sapor/regional_data/norway.rb +130 -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 +61 -0
- data/spec/unit/catalonia_with_vox_spec.rb +62 -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_france_spec.rb +73 -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_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/iceland_with_j_spec.rb +58 -0
- data/spec/unit/ireland_2016_spec.rb +62 -0
- data/spec/unit/ireland_spec.rb +62 -0
- data/spec/unit/largest_remainder_spec.rb +79 -0
- data/spec/unit/latvia_spec.rb +62 -0
- data/spec/unit/luxembourg_spec.rb +55 -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 +69 -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 +502 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
# Statistical Analysis of Polling Results (SAPoR)
|
2
|
+
# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
|
3
|
+
#
|
4
|
+
# This file is part of SAPoR.
|
5
|
+
#
|
6
|
+
# SAPoR is free software: you can redistribute it and/or modify it under the
|
7
|
+
# terms of the GNU General Public License as published by the Free Software
|
8
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
9
|
+
# version.
|
10
|
+
#
|
11
|
+
# SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
|
12
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You can find a copy of the GNU General Public License in /doc/gpl.txt
|
16
|
+
#
|
17
|
+
|
18
|
+
# Source: "12.Saeimas vēlēšanas". Retrieved on 9 August 2018.
|
19
|
+
# URL: http://sv2014.cvk.lv/index_rez.html
|
20
|
+
|
21
|
+
Kurzeme | Zaļo un Zemnieku savienība | 41,840
|
22
|
+
Kurzeme | Vienotība | 23,034
|
23
|
+
Kurzeme | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 21,239
|
24
|
+
Kurzeme | Sociāldemokrātiskā Partija “Saskaņa” | 10,307
|
25
|
+
Kurzeme | No sirds Latvijai | 8,369
|
26
|
+
Kurzeme | Latvijas Reģionu apvienība | 6,705
|
27
|
+
Kurzeme | Vienoti Latvijai | 980
|
28
|
+
Kurzeme | Latvijas attīstībai | 796
|
29
|
+
Kurzeme | Jaunā konservatīvā partija | 736
|
30
|
+
Kurzeme | Latvijas Krievu savienība | 575
|
31
|
+
Kurzeme | Partija “Brīvība. Brīvs no bailēm, naida un dusmām” | 308
|
32
|
+
Kurzeme | Politiskā partija Izaugsme | 121
|
33
|
+
Kurzeme | “Suverenitāte” | 111
|
34
|
+
|
35
|
+
Latgale | Sociāldemokrātiskā Partija “Saskaņa” | 41,884
|
36
|
+
Latgale | Zaļo un Zemnieku savienība | 19,714
|
37
|
+
Latgale | Vienotība | 16,187
|
38
|
+
Latgale | No sirds Latvijai | 9,070
|
39
|
+
Latgale | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 5,442
|
40
|
+
Latgale | Latvijas Krievu savienība | 4,970
|
41
|
+
Latgale | Latvijas Reģionu apvienība | 4,025
|
42
|
+
Latgale | Vienoti Latvijai | 1,709
|
43
|
+
Latgale | Latvijas attīstībai | 712
|
44
|
+
Latgale | Jaunā konservatīvā partija | 650
|
45
|
+
Latgale | Partija “Brīvība. Brīvs no bailēm, naida un dusmām” | 247
|
46
|
+
Latgale | “Suverenitāte” | 206
|
47
|
+
Latgale | Politiskā partija Izaugsme | 104
|
48
|
+
|
49
|
+
Rīga | Sociāldemokrātiskā Partija “Saskaņa” | 111,872
|
50
|
+
Rīga | Vienotība | 65,359
|
51
|
+
Rīga | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 49,406
|
52
|
+
Rīga | Zaļo un Zemnieku savienība | 26,219
|
53
|
+
Rīga | Latvijas Reģionu apvienība | 24,238
|
54
|
+
Rīga | No sirds Latvijai | 17,414
|
55
|
+
Rīga | Latvijas Krievu savienība | 5,142
|
56
|
+
Rīga | Vienoti Latvijai | 3,618
|
57
|
+
Rīga | Jaunā konservatīvā partija | 2,414
|
58
|
+
Rīga | Latvijas attīstībai | 2,134
|
59
|
+
Rīga | Partija “Brīvība. Brīvs no bailēm, naida un dusmām” | 406
|
60
|
+
Rīga | Politiskā partija Izaugsme | 368
|
61
|
+
Rīga | “Suverenitāte” | 287
|
62
|
+
|
63
|
+
Vidzeme | Vienotība | 65,359
|
64
|
+
Vidzeme | Zaļo un Zemnieku savienība | 54,699
|
65
|
+
Vidzeme | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 51,261
|
66
|
+
Vidzeme | Sociāldemokrātiskā Partija “Saskaņa” | 31,413
|
67
|
+
Vidzeme | Latvijas Reģionu apvienība | 19,069
|
68
|
+
Vidzeme | No sirds Latvijai | 18,362
|
69
|
+
Vidzeme | Latvijas attīstībai | 3,104
|
70
|
+
Vidzeme | Vienoti Latvijai | 2,962
|
71
|
+
Vidzeme | Latvijas Krievu savienība | 1,791
|
72
|
+
Vidzeme | Jaunā konservatīvā partija | 1,680
|
73
|
+
Vidzeme | Politiskā partija Izaugsme | 693
|
74
|
+
Vidzeme | Partija “Brīvība. Brīvs no bailēm, naida un dusmām” | 567
|
75
|
+
Vidzeme | “Suverenitāte” | 260
|
76
|
+
|
77
|
+
Zemgale | Zaļo un Zemnieku savienība | 35,738
|
78
|
+
Zemgale | Vienotība | 29,596
|
79
|
+
Zemgale | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 24,219
|
80
|
+
Zemgale | Sociāldemokrātiskā Partija “Saskaņa” | 14,411
|
81
|
+
Zemgale | No sirds Latvijai | 9,306
|
82
|
+
Zemgale | Latvijas Reģionu apvienība | 6,775
|
83
|
+
Zemgale | Latvijas Krievu savienība | 1,912
|
84
|
+
Zemgale | Vienoti Latvijai | 1,519
|
85
|
+
Zemgale | Latvijas attīstībai | 1,410
|
86
|
+
Zemgale | Jaunā konservatīvā partija | 909
|
87
|
+
Zemgale | Politiskā partija Izaugsme | 229
|
88
|
+
Zemgale | Partija “Brīvība. Brīvs no bailēm, naida un dusmām” | 207
|
89
|
+
Zemgale | “Suverenitāte” | 169
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# Statistical Analysis of Polling Results (SAPoR)
|
2
|
+
# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
|
3
|
+
#
|
4
|
+
# This file is part of SAPoR.
|
5
|
+
#
|
6
|
+
# SAPoR is free software: you can redistribute it and/or modify it under the
|
7
|
+
# terms of the GNU General Public License as published by the Free Software
|
8
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
9
|
+
# version.
|
10
|
+
#
|
11
|
+
# SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
|
12
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You can find a copy of the GNU General Public License in /doc/gpl.txt
|
16
|
+
#
|
17
|
+
|
18
|
+
# Source: "13. Saeimas vēlēšanas". Retrieved on 28 December 2019.
|
19
|
+
# URL: https://sv2018.cvk.lv/pub/ElectionResults
|
20
|
+
|
21
|
+
Kurzeme | Politiskā partija „KPV LV” | 21,220
|
22
|
+
Kurzeme | Jaunā konservatīvā partija | 15,751
|
23
|
+
Kurzeme | Zaļo un Zemnieku savienība | 14,925
|
24
|
+
Kurzeme | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 13,292
|
25
|
+
Kurzeme | Attīstībai/Par! | 11,830
|
26
|
+
Kurzeme | Sociāldemokrātiskā partija “Saskaņa” | 8,960
|
27
|
+
Kurzeme | Jaunā VIENOTĪBA | 5,839
|
28
|
+
Kurzeme | Latvijas Reģionu Apvienība | 5,661
|
29
|
+
Kurzeme | PROGRESĪVIE | 2,695
|
30
|
+
Kurzeme | No sirds Latvijai | 1,241
|
31
|
+
Kurzeme | Latvijas Krievu savienība | 912
|
32
|
+
Kurzeme | Latviešu Nacionālisti | 616
|
33
|
+
Kurzeme | Apvienība SKG | 330
|
34
|
+
Kurzeme | Par Alternatīvu | 207
|
35
|
+
Kurzeme | Latvijas centriskā partija | 150
|
36
|
+
Kurzeme | Rīcības partija | 106
|
37
|
+
|
38
|
+
Latgale | Sociāldemokrātiskā partija “Saskaņa” | 32,159
|
39
|
+
Latgale | Zaļo un Zemnieku savienība | 12,539
|
40
|
+
Latgale | Latvijas Krievu savienība | 9,561
|
41
|
+
Latgale | Jaunā konservatīvā partija | 7,900
|
42
|
+
Latgale | Politiskā partija „KPV LV” | 6,874
|
43
|
+
Latgale | Jaunā VIENOTĪBA | 5,067
|
44
|
+
Latgale | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 4,465
|
45
|
+
Latgale | Attīstībai/Par! | 4,181
|
46
|
+
Latgale | Latvijas Reģionu Apvienība | 3,849
|
47
|
+
Latgale | No sirds Latvijai | 865
|
48
|
+
Latgale | PROGRESĪVIE | 840
|
49
|
+
Latgale | Apvienība SKG | 242
|
50
|
+
Latgale | Latviešu Nacionālisti | 209
|
51
|
+
Latgale | Rīcības partija | 204
|
52
|
+
Latgale | Par Alternatīvu | 168
|
53
|
+
Latgale | Latvijas centriskā partija | 154
|
54
|
+
|
55
|
+
Rīga | Sociāldemokrātiskā partija “Saskaņa” | 88,260
|
56
|
+
Rīga | Attīstībai/Par! | 39,209
|
57
|
+
Rīga | Politiskā partija „KPV LV” | 35,895
|
58
|
+
Rīga | Jaunā konservatīvā partija | 35,696
|
59
|
+
Rīga | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 26,995
|
60
|
+
Rīga | Jaunā VIENOTĪBA | 19,536
|
61
|
+
Rīga | Zaļo un Zemnieku savienība | 14,103
|
62
|
+
Rīga | Latvijas Krievu savienība | 11,207
|
63
|
+
Rīga | PROGRESĪVIE | 9,936
|
64
|
+
Rīga | Latvijas Reģionu Apvienība | 6,066
|
65
|
+
Rīga | No sirds Latvijai | 2,003
|
66
|
+
Rīga | Par Alternatīvu | 1,265
|
67
|
+
Rīga | Latviešu Nacionālisti | 1,153
|
68
|
+
Rīga | Apvienība SKG | 396
|
69
|
+
Rīga | Rīcības partija | 282
|
70
|
+
Rīga | Latvijas centriskā partija | 226
|
71
|
+
|
72
|
+
Vidzeme | Jaunā konservatīvā partija | 38,893
|
73
|
+
Vidzeme | Politiskā partija „KPV LV” | 34,341
|
74
|
+
Vidzeme | Attīstībai/Par! | 33,651
|
75
|
+
Vidzeme | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 31,466
|
76
|
+
Vidzeme | Zaļo un Zemnieku savienība | 27,448
|
77
|
+
Vidzeme | Sociāldemokrātiskā partija “Saskaņa” | 26,146
|
78
|
+
Vidzeme | Jaunā VIENOTĪBA | 16,940
|
79
|
+
Vidzeme | Latvijas Reģionu Apvienība | 14,458
|
80
|
+
Vidzeme | PROGRESĪVIE | 6,239
|
81
|
+
Vidzeme | Latvijas Krievu savienība | 3,061
|
82
|
+
Vidzeme | No sirds Latvijai | 1,844
|
83
|
+
Vidzeme | Latviešu Nacionālisti | 1,387
|
84
|
+
Vidzeme | Par Alternatīvu | 787
|
85
|
+
Vidzeme | Apvienība SKG | 506
|
86
|
+
Vidzeme | Rīcības partija | 297
|
87
|
+
Vidzeme | Latvijas centriskā partija | 211
|
88
|
+
|
89
|
+
Zemgale | Politiskā partija „KPV LV” | 21,934
|
90
|
+
Zemgale | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 16,745
|
91
|
+
Zemgale | Jaunā konservatīvā partija | 16,454
|
92
|
+
Zemgale | Zaļo un Zemnieku savienība | 14,660
|
93
|
+
Zemgale | Attīstībai/Par! | 12,814
|
94
|
+
Zemgale | Sociāldemokrātiskā partija “Saskaņa” | 11,592
|
95
|
+
Zemgale | Jaunā VIENOTĪBA | 9,160
|
96
|
+
Zemgale | Latvijas Reģionu Apvienība | 4,984
|
97
|
+
Zemgale | PROGRESĪVIE | 2,368
|
98
|
+
Zemgale | Latvijas Krievu savienība | 2,273
|
99
|
+
Zemgale | No sirds Latvijai | 1,161
|
100
|
+
Zemgale | Latviešu Nacionālisti | 880
|
101
|
+
Zemgale | Par Alternatīvu | 473
|
102
|
+
Zemgale | Apvienība SKG | 261
|
103
|
+
Zemgale | Rīcības partija | 170
|
104
|
+
Zemgale | Latvijas centriskā partija | 156
|
@@ -0,0 +1,111 @@
|
|
1
|
+
#
|
2
|
+
# Statistical Analysis of Polling Results (SAPoR)
|
3
|
+
# Copyright (C) 2020 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 Latvia.
|
22
|
+
#
|
23
|
+
class Latvia < Area
|
24
|
+
include Singleton
|
25
|
+
def area_code
|
26
|
+
'LV'
|
27
|
+
end
|
28
|
+
|
29
|
+
def coalitions
|
30
|
+
COALITIONS
|
31
|
+
end
|
32
|
+
|
33
|
+
def no_of_seats
|
34
|
+
SEAT_DISTRIBUTION.values.inject(:+)
|
35
|
+
end
|
36
|
+
|
37
|
+
def overall_election_results_of_2018
|
38
|
+
if @overall_election_results_of_2018.nil?
|
39
|
+
@overall_election_results_of_2018 = \
|
40
|
+
summarize_election_results(election_results_of_2018)
|
41
|
+
end
|
42
|
+
@overall_election_results_of_2018
|
43
|
+
end
|
44
|
+
|
45
|
+
def population_size
|
46
|
+
# Voter turnout on 6 October 2018
|
47
|
+
839_000
|
48
|
+
end
|
49
|
+
|
50
|
+
def seats(simulation)
|
51
|
+
electoral_system.project(simulation)
|
52
|
+
end
|
53
|
+
|
54
|
+
def threshold
|
55
|
+
THRESHOLD
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
AP_PARTY = 'Attīstībai/Par!'.freeze
|
61
|
+
JKP_PARTY = 'Jaunā konservatīvā partija'.freeze
|
62
|
+
JV_PARTY = 'Jaunā VIENOTĪBA'.freeze
|
63
|
+
KPVLV_PARTY = 'Politiskā partija „KPV LV”'.freeze
|
64
|
+
NA_PARTY = 'Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un ' \
|
65
|
+
'Brīvībai/LNNK”'.freeze
|
66
|
+
SDPS_PARTY = 'Sociāldemokrātiskā partija “Saskaņa”'.freeze
|
67
|
+
ZZS_PARTY = 'Zaļo un Zemnieku savienība'.freeze
|
68
|
+
|
69
|
+
COALITIONS = [[AP_PARTY, JKP_PARTY, JV_PARTY, KPVLV_PARTY],
|
70
|
+
[AP_PARTY, JKP_PARTY, JV_PARTY, KPVLV_PARTY, NA_PARTY],
|
71
|
+
[AP_PARTY, JKP_PARTY, JV_PARTY, NA_PARTY],
|
72
|
+
[AP_PARTY, JKP_PARTY, JV_PARTY, NA_PARTY, ZZS_PARTY],
|
73
|
+
[AP_PARTY, JKP_PARTY, KPVLV_PARTY, NA_PARTY],
|
74
|
+
[AP_PARTY, JKP_PARTY, NA_PARTY, ZZS_PARTY],
|
75
|
+
[AP_PARTY, JKP_PARTY, SDPS_PARTY],
|
76
|
+
[AP_PARTY, JV_PARTY, KPVLV_PARTY, NA_PARTY],
|
77
|
+
[AP_PARTY, JV_PARTY, NA_PARTY, ZZS_PARTY],
|
78
|
+
[AP_PARTY, NA_PARTY, ZZS_PARTY],
|
79
|
+
[AP_PARTY, SDPS_PARTY],
|
80
|
+
[JKP_PARTY, JV_PARTY, KPVLV_PARTY, NA_PARTY],
|
81
|
+
[JKP_PARTY, JV_PARTY, NA_PARTY, ZZS_PARTY],
|
82
|
+
[JKP_PARTY, NA_PARTY, ZZS_PARTY],
|
83
|
+
[KPVLV_PARTY, SDPS_PARTY],
|
84
|
+
[KPVLV_PARTY, SDPS_PARTY, ZZS_PARTY],
|
85
|
+
[NA_PARTY, JV_PARTY, ZZS_PARTY]].freeze
|
86
|
+
|
87
|
+
SEAT_DISTRIBUTION = { 'Kurzeme' => 12, 'Latgale' => 14, 'Rīga' => 35,
|
88
|
+
'Vidzeme' => 25, 'Zemgale' => 14 }.freeze
|
89
|
+
|
90
|
+
THRESHOLD = 0.05
|
91
|
+
|
92
|
+
def election_results_of_2018
|
93
|
+
if @election_results_of_2018.nil?
|
94
|
+
@election_results_of_2018 = load_election_results(
|
95
|
+
'latvia-20181006.psv'
|
96
|
+
)
|
97
|
+
end
|
98
|
+
@election_results_of_2018
|
99
|
+
end
|
100
|
+
|
101
|
+
def electoral_system
|
102
|
+
if @electoral_system.nil?
|
103
|
+
@electoral_system = MultiDistrictProportional.new( \
|
104
|
+
overall_election_results_of_2018, election_results_of_2018,
|
105
|
+
SEAT_DISTRIBUTION, SainteLagueDenominators, 0, THRESHOLD
|
106
|
+
)
|
107
|
+
end
|
108
|
+
@electoral_system
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Statistical Analysis of Polling Results (SAPoR)
|
2
|
+
# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
|
3
|
+
#
|
4
|
+
# This file is part of SAPoR.
|
5
|
+
#
|
6
|
+
# SAPoR is free software: you can redistribute it and/or modify it under the
|
7
|
+
# terms of the GNU General Public License as published by the Free Software
|
8
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
9
|
+
# version.
|
10
|
+
#
|
11
|
+
# SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
|
12
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You can find a copy of the GNU General Public License in /doc/gpl.txt
|
16
|
+
#
|
17
|
+
|
18
|
+
# Source: "Résultats officieux — Site officiel des élections // Grand-Duché de
|
19
|
+
# Luxembourg". Retrieved on 20 September 2018.
|
20
|
+
# URL: https://elections.public.lu/fr/elections-legislatives/2013/resultats.html
|
21
|
+
|
22
|
+
Centre | Chrëschtlech-Sozial Vollekspartei | 385,390
|
23
|
+
Centre | Demokratesch Partei | 273,069
|
24
|
+
Centre | Lëtzebuerger Sozialistesch Aarbechterpartei | 159,905
|
25
|
+
Centre | déi gréng | 114,145
|
26
|
+
Centre | Alternativ Demokratesch Reformpartei | 54,709
|
27
|
+
Centre | Déi Lénk | 51,851
|
28
|
+
Centre | Piratepartei Lëtzebuerg | 29,633
|
29
|
+
Centre | Partei fir Integral Demokratie | 13,318
|
30
|
+
Centre | Kommunistesch Partei Lëtzebuerg | 9,425
|
31
|
+
|
32
|
+
Est | Chrëschtlech-Sozial Vollekspartei | 71,786
|
33
|
+
Est | Demokratesch Partei | 36,237
|
34
|
+
Est | Lëtzebuerger Sozialistesch Aarbechterpartei | 28,386
|
35
|
+
Est | déi gréng | 25,486
|
36
|
+
Est | Alternativ Demokratesch Reformpartei | 16,901
|
37
|
+
Est | Déi Lénk | 5,941
|
38
|
+
Est | Piratepartei Lëtzebuerg | 5,226
|
39
|
+
Est | Partei fir Integral Demokratie | 3,018
|
40
|
+
Est | Kommunistesch Partei Lëtzebuerg | 1,537
|
41
|
+
|
42
|
+
Nord | Chrëschtlech-Sozial Vollekspartei | 107,163
|
43
|
+
Nord | Demokratesch Partei | 75,426
|
44
|
+
Nord | Lëtzebuerger Sozialistesch Aarbechterpartei | 54,788
|
45
|
+
Nord | déi gréng | 28,646
|
46
|
+
Nord | Alternativ Demokratesch Reformpartei | 20,246
|
47
|
+
Nord | Piratepartei Lëtzebuerg | 10,733
|
48
|
+
Nord | Partei fir Integral Demokratie | 10,384
|
49
|
+
Nord | Déi Lénk | 8,138
|
50
|
+
Nord | Kommunistesch Partei Lëtzebuerg | 2,575
|
51
|
+
|
52
|
+
Sud | Chrëschtlech-Sozial Vollekspartei | 539,297
|
53
|
+
Sud | Lëtzebuerger Sozialistesch Aarbechterpartei | 421,507
|
54
|
+
Sud | Demokratesch Partei | 213,147
|
55
|
+
Sud | déi gréng | 163,643
|
56
|
+
Sud | Alternativ Demokratesch Reformpartei | 125,827
|
57
|
+
Sud | Déi Lénk | 95,829
|
58
|
+
Sud | Piratepartei Lëtzebuerg | 50,678
|
59
|
+
Sud | Kommunistesch Partei Lëtzebuerg | 40,132
|
60
|
+
Sud | Partei fir Integral Demokratie | 22,570
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Statistical Analysis of Polling Results (SAPoR)
|
2
|
+
# Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
|
3
|
+
#
|
4
|
+
# This file is part of SAPoR.
|
5
|
+
#
|
6
|
+
# SAPoR is free software: you can redistribute it and/or modify it under the
|
7
|
+
# terms of the GNU General Public License as published by the Free Software
|
8
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
9
|
+
# version.
|
10
|
+
#
|
11
|
+
# SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
|
12
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You can find a copy of the GNU General Public License in /doc/gpl.txt
|
16
|
+
#
|
17
|
+
|
18
|
+
# Source: "Résultats officieux — Site officiel des élections // Grand-Duché de
|
19
|
+
# Luxembourg". Retrieved on 20 September 2018.
|
20
|
+
# URL: https://elections.public.lu/fr/elections-legislatives/2013/resultats.html
|
21
|
+
|
22
|
+
Centre | Chrëschtlech-Sozial Vollekspartei | 337,687
|
23
|
+
Centre | Demokratesch Partei | 280,144
|
24
|
+
Centre | déi gréng | 187,790
|
25
|
+
Centre | Lëtzebuerger Sozialistesch Aarbechterpartei | 135,968
|
26
|
+
Centre | Alternativ Demokratesch Reformpartei | 79,159
|
27
|
+
Centre | déi Lénk | 66,253
|
28
|
+
Centre | Piratepartei Lëtzebuerg | 59,537
|
29
|
+
Centre | Kommunistesch Partei Lëtzebuerg | 8,448
|
30
|
+
Centre | Demokratie | 3,949
|
31
|
+
|
32
|
+
Est | Chrëschtlech-Sozial Vollekspartei | 62,156
|
33
|
+
Est | Demokratesch Partei | 43,681
|
34
|
+
Est | déi gréng | 34,930
|
35
|
+
Est | Lëtzebuerger Sozialistesch Aarbechterpartei | 27,222
|
36
|
+
Est | Alternativ Demokratesch Reformpartei | 20,255
|
37
|
+
Est | Piratepartei Lëtzebuerg | 14,762
|
38
|
+
Est | déi Lénk | 6,984
|
39
|
+
Est | Kommunistesch Partei Lëtzebuerg | 1,396
|
40
|
+
|
41
|
+
Nord | Chrëschtlech-Sozial Vollekspartei | 111,067
|
42
|
+
Nord | Demokratesch Partei | 59,039
|
43
|
+
Nord | Lëtzebuerger Sozialistesch Aarbechterpartei | 54,682
|
44
|
+
Nord | déi gréng | 44,728
|
45
|
+
Nord | Alternativ Demokratesch Reformpartei | 33,751
|
46
|
+
Nord | Piratepartei Lëtzebuerg | 26,421
|
47
|
+
Nord | déi Lénk | 12,164
|
48
|
+
Nord | Kommunistesch Partei Lëtzebuerg | 2,734
|
49
|
+
|
50
|
+
Sud | Chrëschtlech-Sozial Vollekspartei | 488,471
|
51
|
+
Sud | Lëtzebuerger Sozialistesch Aarbechterpartei | 403,460
|
52
|
+
Sud | Demokratesch Partei | 214,216
|
53
|
+
Sud | déi gréng | 266,445
|
54
|
+
Sud | Alternativ Demokratesch Reformpartei | 159,223
|
55
|
+
Sud | déi Lénk | 108,193
|
56
|
+
Sud | Piratepartei Lëtzebuerg | 126,829
|
57
|
+
Sud | Kommunistesch Partei Lëtzebuerg | 32,338
|
58
|
+
Sud | Demokratie | 6,371
|
59
|
+
Sud | déi Konservativ | 9,516
|
@@ -0,0 +1,88 @@
|
|
1
|
+
#
|
2
|
+
# Statistical Analysis of Polling Results (SAPoR)
|
3
|
+
# Copyright (C) 2020 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 Luxembourg.
|
22
|
+
#
|
23
|
+
class Luxembourg < Area
|
24
|
+
include Singleton
|
25
|
+
def area_code
|
26
|
+
'LU'
|
27
|
+
end
|
28
|
+
|
29
|
+
def coalitions
|
30
|
+
COALITIONS
|
31
|
+
end
|
32
|
+
|
33
|
+
def no_of_seats
|
34
|
+
SEAT_DISTRIBUTION.values.inject(:+)
|
35
|
+
end
|
36
|
+
|
37
|
+
def overall_election_results_of_2018
|
38
|
+
if @overall_election_results_of_2018.nil?
|
39
|
+
@overall_election_results_of_2018 = \
|
40
|
+
summarize_election_results(election_results_of_2018)
|
41
|
+
end
|
42
|
+
@overall_election_results_of_2018
|
43
|
+
end
|
44
|
+
|
45
|
+
def population_size
|
46
|
+
# Voter turnout on 14 October 2018 (note: multiple votes per voter)
|
47
|
+
3_529_969
|
48
|
+
end
|
49
|
+
|
50
|
+
def seats(simulation)
|
51
|
+
electoral_system.project(simulation)
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
CSV_PARTY = 'Chrëschtlech-Sozial Vollekspartei'.freeze
|
57
|
+
DG_PARTY = 'déi gréng'.freeze
|
58
|
+
DP_PARTY = 'Demokratesch Partei'.freeze
|
59
|
+
LSAP_PARTY = 'Lëtzebuerger Sozialistesch Aarbechterpartei'.freeze
|
60
|
+
|
61
|
+
COALITIONS = [[CSV_PARTY],
|
62
|
+
[CSV_PARTY, LSAP_PARTY],
|
63
|
+
[CSV_PARTY, DP_PARTY],
|
64
|
+
[DG_PARTY, DP_PARTY, LSAP_PARTY]].freeze
|
65
|
+
|
66
|
+
SEAT_DISTRIBUTION = { 'Centre' => 21, 'Est' => 7, 'Nord' => 9,
|
67
|
+
'Sud' => 23 }.freeze
|
68
|
+
|
69
|
+
def election_results_of_2018
|
70
|
+
if @election_results_of_2018.nil?
|
71
|
+
@election_results_of_2018 = load_election_results(
|
72
|
+
'luxembourg-20181014.psv'
|
73
|
+
)
|
74
|
+
end
|
75
|
+
@election_results_of_2018
|
76
|
+
end
|
77
|
+
|
78
|
+
def electoral_system
|
79
|
+
if @electoral_system.nil?
|
80
|
+
@electoral_system = MultiDistrictProportional.new( \
|
81
|
+
overall_election_results_of_2018, election_results_of_2018,
|
82
|
+
SEAT_DISTRIBUTION, DhondtDenominators
|
83
|
+
)
|
84
|
+
end
|
85
|
+
@electoral_system
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|