sapor 0.1b1

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.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/Area Class Diagram.dia +0 -0
  3. data/Area Class Diagram.png +0 -0
  4. data/Class Diagram.dia +0 -0
  5. data/Class Diagram.png +0 -0
  6. data/Examples.md +361 -0
  7. data/LICENSE +674 -0
  8. data/README.md +70 -0
  9. data/Rakefile +18 -0
  10. data/Technical Documentation.md +14 -0
  11. data/bin/create_installation_package.sh +49 -0
  12. data/bin/install.sh +45 -0
  13. data/bin/sapor.rb +22 -0
  14. data/bin/sapor.sh +105 -0
  15. data/lib/sapor.rb +44 -0
  16. data/lib/sapor/binomials_cache.rb +45 -0
  17. data/lib/sapor/combinations_distribution.rb +180 -0
  18. data/lib/sapor/dichotomies.rb +98 -0
  19. data/lib/sapor/dichotomy.rb +138 -0
  20. data/lib/sapor/first_past_the_post.rb +78 -0
  21. data/lib/sapor/leveled_proportional.rb +64 -0
  22. data/lib/sapor/log4r_logger.rb +49 -0
  23. data/lib/sapor/log_facade.rb +40 -0
  24. data/lib/sapor/number_formatter.rb +45 -0
  25. data/lib/sapor/poll.rb +137 -0
  26. data/lib/sapor/polychotomy.rb +359 -0
  27. data/lib/sapor/proportional.rb +128 -0
  28. data/lib/sapor/pseudorandom_multirange_enumerator.rb +87 -0
  29. data/lib/sapor/regional_data/area.rb +80 -0
  30. data/lib/sapor/regional_data/catalonia-2012-2015.psv +100 -0
  31. data/lib/sapor/regional_data/catalonia-2012.psv +87 -0
  32. data/lib/sapor/regional_data/catalonia.rb +90 -0
  33. data/lib/sapor/regional_data/norway.rb +408 -0
  34. data/lib/sapor/regional_data/united_kingdom.rb +1075 -0
  35. data/lib/sapor/regional_data/utopia.rb +66 -0
  36. data/sapor.gemspec +35 -0
  37. data/spec/integration/area_spec.rb +28 -0
  38. data/spec/integration/poll_spec.rb +107 -0
  39. data/spec/integration/sample.poll +7 -0
  40. data/spec/spec_helper.rb +31 -0
  41. data/spec/unit/area_spec.rb +115 -0
  42. data/spec/unit/binomials_cache_spec.rb +34 -0
  43. data/spec/unit/catalonia_spec.rb +82 -0
  44. data/spec/unit/combinations_distribution_spec.rb +241 -0
  45. data/spec/unit/denominators_spec.rb +34 -0
  46. data/spec/unit/dichotomies_spec.rb +154 -0
  47. data/spec/unit/dichotomy_spec.rb +320 -0
  48. data/spec/unit/first_past_the_post_spec.rb +53 -0
  49. data/spec/unit/leveled_proportional_spec.rb +51 -0
  50. data/spec/unit/norway_spec.rb +47 -0
  51. data/spec/unit/number_formatter_spec.rb +173 -0
  52. data/spec/unit/poll_spec.rb +105 -0
  53. data/spec/unit/polychotomy_spec.rb +332 -0
  54. data/spec/unit/proportional_spec.rb +86 -0
  55. data/spec/unit/pseudorandom_multirange_enumerator_spec.rb +82 -0
  56. metadata +119 -0
@@ -0,0 +1,128 @@
1
+ # encoding: utf-8
2
+ #
3
+ # Statistical Analysis of Polling Results (SAPoR)
4
+ # Copyright (C) 2014 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
+ # Class representing a proportional electoral system.
23
+ #
24
+ class Proportional
25
+ def initialize(last_election_result, last_detailed_election_result,
26
+ seat_distribution, denominators_class, threshold = 0)
27
+ @last_election_result = last_election_result
28
+ @last_detailed_election_result = last_detailed_election_result
29
+ @seat_distribution = seat_distribution
30
+ @denominators_class = denominators_class
31
+ @threshold = threshold
32
+ end
33
+
34
+ def project(simulation)
35
+ multiplicators = calculate_multiplicators(simulation)
36
+ result = create_empty_result(simulation)
37
+ @last_detailed_election_result.each_pair do |name, local_last_result|
38
+ no_of_seats = @seat_distribution[name]
39
+ seats = local_seats(no_of_seats, local_last_result, multiplicators)
40
+ add_seats_to_result(result, seats)
41
+ end
42
+ result
43
+ end
44
+
45
+ private
46
+
47
+ def add_seats_to_result(result, seats)
48
+ seats.each do |seat|
49
+ if result.key?(seat)
50
+ result[seat] += 1
51
+ else
52
+ result[seat] = 1
53
+ end
54
+ end
55
+ end
56
+
57
+ def calculate_multiplicators(simulation)
58
+ simulation_sum = simulation.values.inject(:+)
59
+ last_election_sum = @last_election_result.values.inject(:+)
60
+ multiplicators = {}
61
+ simulation.each_key do |choice|
62
+ new_fraction = simulation[choice].to_f / simulation_sum
63
+ last_fraction = @last_election_result[choice].to_f / last_election_sum
64
+ multiplicators[choice] = new_fraction / last_fraction
65
+ end
66
+ multiplicators
67
+ end
68
+
69
+ def create_empty_result(simulation)
70
+ result = {}
71
+ simulation.each_key do |choice|
72
+ result[choice] = 0
73
+ end
74
+ result[OTHER] = 0
75
+ result
76
+ end
77
+
78
+ def local_votes(local_last_result, multiplicators)
79
+ local_votes = {}
80
+ local_last_result.each_pair do |choice, votes|
81
+ if multiplicators.key?(choice)
82
+ local_votes[choice] = votes * multiplicators[choice]
83
+ else
84
+ local_votes[choice] = votes
85
+ end
86
+ end
87
+ local_votes
88
+ end
89
+
90
+ def local_quotients(local_votes, local_threshold, no_of_seats)
91
+ local_quotients = []
92
+ local_votes.each_pair do |choice, new_value|
93
+ next if new_value < local_threshold
94
+ @denominators_class.get(no_of_seats).each do |d|
95
+ local_quotients << [choice, new_value.to_f / d]
96
+ end
97
+ end
98
+ local_quotients
99
+ end
100
+
101
+ def local_seats(no_of_seats, local_last_result, multiplicators)
102
+ local_votes = local_votes(local_last_result, multiplicators)
103
+ local_threshold = local_votes.values.inject(:+).to_f * @threshold
104
+ local_quotients = local_quotients(local_votes, local_threshold,
105
+ no_of_seats)
106
+ sorted_quotients = local_quotients.sort { |a, b| b.last <=> a.last }
107
+ sorted_quotients.map(&:first).slice(0, no_of_seats)
108
+ end
109
+ end
110
+
111
+ #
112
+ # Class building the denominators for D'Hondt.
113
+ #
114
+ class DhondtDenominators
115
+ def self.get(size)
116
+ Range.new(1, size)
117
+ end
118
+ end
119
+
120
+ #
121
+ # Class building the denominators for modified Sainte-Lague.
122
+ #
123
+ class SainteLague14Denominators
124
+ def self.get(size)
125
+ Range.new(1, size).map { |a| a.equal?(1) ? 1.4 : a * 2 - 1 }
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,87 @@
1
+ # encoding: utf-8
2
+ #
3
+ # Statistical Analysis of Polling Results (SAPoR)
4
+ # Copyright (C) 2014 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
+ require 'prime'
21
+
22
+ module Sapor
23
+ #
24
+ # A pseudo-random multi-range enumerator. It uses prime numbers to iterate
25
+ # in a pseudo-random way through the hyper-rectangle with dimensions
26
+ # provided as the constructor parameter. If a suitable set of primes can't
27
+ # be found, the constructor will raise an exception.
28
+ #
29
+ class PseudoRandomMultiRangeEnumerator
30
+ def initialize(dimensions)
31
+ @dimensions = dimensions
32
+ @incrementers = calculate_incrementers
33
+ end
34
+
35
+ def each
36
+ return enum_for { @dimensions.inject(:*) } unless block_given?
37
+ counters = Array.new(@dimensions.size, 0)
38
+ loop do
39
+ yield(counters.dup)
40
+ @incrementers.each_with_index do |incrementer, i|
41
+ counters[i] = (counters[i] + incrementer).modulo(@dimensions[i])
42
+ end
43
+ break if all_zeros?(counters)
44
+ end
45
+ end
46
+
47
+ private
48
+
49
+ def calculate_incrementers
50
+ incrementers = []
51
+ incrementer = 0
52
+ calculate_incrementer_indexes.each do |i|
53
+ incrementer = next_incrementer(incrementer)
54
+ if @dimensions[i] < incrementer
55
+ fail(ArgumentError, 'Could not construct suitable incrementers.')
56
+ end
57
+ incrementers[i] = incrementer
58
+ end
59
+ incrementers
60
+ end
61
+
62
+ def calculate_incrementer_indexes
63
+ @dimensions.each_with_index.sort.map(&:last)
64
+ end
65
+
66
+ def next_incrementer(incrementer)
67
+ incrementer += 1
68
+ while incrementer > 1 &&
69
+ (!prime?(incrementer) || !relative_prime?(incrementer))
70
+ incrementer += 1
71
+ end
72
+ incrementer
73
+ end
74
+
75
+ def prime?(number)
76
+ Prime.prime?(number)
77
+ end
78
+
79
+ def relative_prime?(incrementer)
80
+ @dimensions.map { |dimension| dimension.gcd(incrementer) }.max == 1
81
+ end
82
+
83
+ def all_zeros?(counters)
84
+ counters.max == 0
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,80 @@
1
+ # encoding: utf-8
2
+ #
3
+ # Statistical Analysis of Polling Results (SAPoR)
4
+ # Copyright (C) 2014 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
+ # Superclass for any area (country, region, city, etc...) for which
23
+ # polls can be registered.
24
+ #
25
+ class Area
26
+ include Singleton
27
+
28
+ def lines_to_election_results(lines)
29
+ results = {}
30
+ lines.each_line { |line| add_line_to_election_results(results, line) }
31
+ results
32
+ end
33
+
34
+ def load_election_results(filename)
35
+ dirname = File.dirname(File.expand_path(__FILE__))
36
+ full_filename = File.expand_path(filename, dirname)
37
+ lines = File.read(full_filename)
38
+ lines_to_election_results(lines)
39
+ end
40
+
41
+ def summarize_election_results(election_results)
42
+ summary = {}
43
+ election_results.each_value do |local_results|
44
+ add_local_results_to_summary(summary, local_results)
45
+ end
46
+ summary
47
+ end
48
+
49
+ private
50
+
51
+ def add_line_to_election_results(results, line)
52
+ return if line.strip.empty? || line.strip.start_with?('#')
53
+ values = line.split('|')
54
+ fail(ArgumentError, "Broken line: #{line}.") unless values.size.equal?(3)
55
+ add_line_values_to_election_results(results, values)
56
+ end
57
+
58
+ def add_line_values_to_election_results(results, values)
59
+ constituency = values[0].strip
60
+ results[constituency] = {} unless results.key?(constituency)
61
+ choice = values[1].strip
62
+ votes = values[2].gsub(',', '').to_i
63
+ if results[constituency].key?(choice)
64
+ fail(ArgumentError, "Choice #{choice} appeared twice in " \
65
+ "constituency #{constituency}.")
66
+ end
67
+ results[constituency][choice] = votes
68
+ end
69
+
70
+ def add_local_results_to_summary(summary, local_results)
71
+ local_results.each_pair do |choice, votes|
72
+ if summary.key?(choice)
73
+ summary[choice] += votes
74
+ else
75
+ summary[choice] = votes
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,100 @@
1
+ # Statistical Analysis of Polling Results (SAPoR)
2
+ # Copyright (C) 2014 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: Argos, Archivo historico electoral, retrieved on 23 May 2015.
19
+ # URL: http://www.argos.gva.es/ahe/index.html
20
+
21
+ # Adapted from catalonia-2012.psv for the 2015 elections using the following
22
+ # transformation rules:
23
+ # c = Junts pel Sí / (Convergència i Unió + Esquerra Republicana de Catalunya – Catalunya Sí)
24
+ # = 39.2% / (30.7% + 13.7%)
25
+ # = 0.882882883
26
+ # Junts pel Sí = c × (Convergència i Unió
27
+ # + Esquerra Republicana de Catalunya – Catalunya Sí)
28
+ # Unió Democràtica de Catalunya = (1 - c) × (Convergència i Unió
29
+ # + Esquerra Republicana de Catalunya
30
+ # – Catalunya Sí)
31
+ # Catalunya Sí que es Pot = Iniciativa per Catalunya Verds – Esquerra Unida i
32
+ # Alternativa
33
+
34
+ Barcelona | Junts pel Sí | 979,373
35
+ Barcelona | Partit dels Socialistes de Catalunya | 418,847
36
+ Barcelona | Partit Popular de Catalunya | 361,656
37
+ Barcelona | Catalunya Sí que es Pot | 303,625
38
+ Barcelona | Ciutadans-Partido de la Ciudadanía | 229,746
39
+ Barcelona | Unió Democràtica de Catalunya | 129,917
40
+ Barcelona | Candidatura d'Unitat Popular – Alternativa d'Esquerres | 92,794
41
+ Barcelona | Plataforma per Catalunya | 51,403
42
+ Barcelona | Solidaritat Catalana per la Independència | 32,296
43
+ Barcelona | Escons en Blanc | 22,817
44
+ Barcelona | Partido Animalista Contra el Maltrato Animal | 16,479
45
+ Barcelona | Pirates de Catalunya | 15,241
46
+ Barcelona | Unió, Progrés i Democràcia | 12,147
47
+ Barcelona | Farts.cat | 9,185
48
+ Barcelona | Via Democràtica | 5,984
49
+ Barcelona | Unificació Comunista d'Espanya | 1,998
50
+
51
+ Girona | Junts pel Sí | 185,048
52
+ Girona | Partit dels Socialistes de Catalunya | 34,688
53
+ Girona | Partit Popular de Catalunya | 33,096
54
+ Girona | Unió Democràtica de Catalunya | 24,547
55
+ Girona | Catalunya Sí que es Pot | 20,397
56
+ Girona | Candidatura d'Unitat Popular – Alternativa d'Esquerres | 14,499
57
+ Girona | Ciutadans-Partido de la Ciudadanía | 12,341
58
+ Girona | Solidaritat Catalana per la Independència | 6,011
59
+ Girona | Plataforma per Catalunya | 3,377
60
+ Girona | Escons en Blanc | 1,946
61
+ Girona | Partido Animalista Contra el Maltrato Animal | 1,565
62
+ Girona | Pirates de Catalunya | 1,137
63
+ Girona | Farts.cat | 718
64
+ Girona | Unió, Progrés i Democràcia | 701
65
+ Girona | Partit Republicà d'Esquerra – Izquierda Republicana | 525
66
+ Girona | Unificació Comunista d'Espanya | 201
67
+
68
+ Lleida | Junts pel Sí | 110,401
69
+ Lleida | Partit Popular de Catalunya | 23,338
70
+ Lleida | Partit dels Socialistes de Catalunya | 21,598
71
+ Lleida | Unió Democràtica de Catalunya | 14,645
72
+ Lleida | Catalunya Sí que es Pot | 11,145
73
+ Lleida | Ciutadans-Partido de la Ciudadanía | 6,881
74
+ Lleida | Candidatura d'Unitat Popular – Alternativa d'Esquerres | 6,302
75
+ Lleida | Solidaritat Catalana per la Independència | 3,038
76
+ Lleida | Escons en Blanc | 1,417
77
+ Lleida | Plataforma per Catalunya | 1,224
78
+ Lleida | Partido Animalista Contra el Maltrato Animal | 752
79
+ Lleida | Pirates de Catalunya | 642
80
+ Lleida | Farts.cat | 476
81
+ Lleida | Unió, Progrés i Democràcia | 392
82
+ Lleida | Partit Republicà d'Esquerra – Izquierda Republicana | 301
83
+ Lleida | Unificació Comunista d'Espanya | 90
84
+
85
+ Tarragona | Junts pel Sí | 148,104
86
+ Tarragona | Partit Popular de Catalunya | 53,591
87
+ Tarragona | Partit dels Socialistes de Catalunya | 48,642
88
+ Tarragona | Ciutadans-Partido de la Ciudadanía | 26,039
89
+ Tarragona | Catalunya Sí que es Pot | 24,538
90
+ Tarragona | Unió Democràtica de Catalunya | 19,646
91
+ Tarragona | Candidatura d'Unitat Popular – Alternativa d'Esquerres | 12,840
92
+ Tarragona | Solidaritat Catalana per la Independència | 5,493
93
+ Tarragona | Plataforma per Catalunya | 4,103
94
+ Tarragona | Escons en Blanc | 2,108
95
+ Tarragona | Partido Animalista Contra el Maltrato Animal | 2,065
96
+ Tarragona | Unió, Progrés i Democràcia | 1,373
97
+ Tarragona | Farts.cat | 1,323
98
+ Tarragona | Pirates de Catalunya | 1,199
99
+ Tarragona | Socialistes i Republicans | 333
100
+ Tarragona | Unificació Comunista d'Espanya | 287
@@ -0,0 +1,87 @@
1
+ # Statistical Analysis of Polling Results (SAPoR)
2
+ # Copyright (C) 2014 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: Argos, Archivo historico electoral, retrieved on 23 May 2015.
19
+ # URL: http://www.argos.gva.es/ahe/index.html
20
+
21
+ Barcelona | Convergència i Unió | 762,628
22
+ Barcelona | Partit dels Socialistes de Catalunya | 418,847
23
+ Barcelona | Partit Popular de Catalunya | 361,656
24
+ Barcelona | Esquerra Republicana de Catalunya – Catalunya Sí | 346,662
25
+ Barcelona | Iniciativa per Catalunya Verds – Esquerra Unida i Alternativa | 303,625
26
+ Barcelona | Ciutadans-Partido de la Ciudadanía | 229,746
27
+ Barcelona | Candidatura d'Unitat Popular – Alternativa d'Esquerres | 92,794
28
+ Barcelona | Plataforma per Catalunya | 51,403
29
+ Barcelona | Solidaritat Catalana per la Independència | 32,296
30
+ Barcelona | Escons en Blanc | 22,817
31
+ Barcelona | Partido Animalista Contra el Maltrato Animal | 16,479
32
+ Barcelona | Pirates de Catalunya | 15,241
33
+ Barcelona | Unió, Progrés i Democràcia | 12,147
34
+ Barcelona | Farts.cat | 9,185
35
+ Barcelona | Via Democràtica | 5,984
36
+ Barcelona | Unificació Comunista d'Espanya | 1,998
37
+
38
+ Girona | Convergència i Unió | 148,237
39
+ Girona | Esquerra Republicana de Catalunya – Catalunya Sí | 61,358
40
+ Girona | Partit dels Socialistes de Catalunya | 34,688
41
+ Girona | Partit Popular de Catalunya | 33,096
42
+ Girona | Iniciativa per Catalunya Verds – Esquerra Unida i Alternativa | 20,397
43
+ Girona | Candidatura d'Unitat Popular – Alternativa d'Esquerres | 14,499
44
+ Girona | Ciutadans-Partido de la Ciudadanía | 12,341
45
+ Girona | Solidaritat Catalana per la Independència | 6,011
46
+ Girona | Plataforma per Catalunya | 3,377
47
+ Girona | Escons en Blanc | 1,946
48
+ Girona | Partido Animalista Contra el Maltrato Animal | 1,565
49
+ Girona | Pirates de Catalunya | 1,137
50
+ Girona | Farts.cat | 718
51
+ Girona | Unió, Progrés i Democràcia | 701
52
+ Girona | Partit Republicà d'Esquerra – Izquierda Republicana | 525
53
+ Girona | Unificació Comunista d'Espanya | 201
54
+
55
+ Lleida | Convergència i Unió | 89,035
56
+ Lleida | Esquerra Republicana de Catalunya – Catalunya Sí | 36,011
57
+ Lleida | Partit Popular de Catalunya | 23,338
58
+ Lleida | Partit dels Socialistes de Catalunya | 21,598
59
+ Lleida | Iniciativa per Catalunya Verds – Esquerra Unida i Alternativa | 11,145
60
+ Lleida | Ciutadans-Partido de la Ciudadanía | 6,881
61
+ Lleida | Candidatura d'Unitat Popular – Alternativa d'Esquerres | 6,302
62
+ Lleida | Solidaritat Catalana per la Independència | 3,038
63
+ Lleida | Escons en Blanc | 1,417
64
+ Lleida | Plataforma per Catalunya | 1,224
65
+ Lleida | Partido Animalista Contra el Maltrato Animal | 752
66
+ Lleida | Pirates de Catalunya | 642
67
+ Lleida | Farts.cat | 476
68
+ Lleida | Unió, Progrés i Democràcia | 392
69
+ Lleida | Partit Republicà d'Esquerra – Izquierda Republicana | 301
70
+ Lleida | Unificació Comunista d'Espanya | 90
71
+
72
+ Tarragona | Convergència i Unió | 113,657
73
+ Tarragona | Esquerra Republicana de Catalunya – Catalunya Sí | 54,093
74
+ Tarragona | Partit Popular de Catalunya | 53,591
75
+ Tarragona | Partit dels Socialistes de Catalunya | 48,642
76
+ Tarragona | Ciutadans-Partido de la Ciudadanía | 26,039
77
+ Tarragona | Iniciativa per Catalunya Verds – Esquerra Unida i Alternativa | 24,538
78
+ Tarragona | Candidatura d'Unitat Popular – Alternativa d'Esquerres | 12,840
79
+ Tarragona | Solidaritat Catalana per la Independència | 5,493
80
+ Tarragona | Plataforma per Catalunya | 4,103
81
+ Tarragona | Escons en Blanc | 2,108
82
+ Tarragona | Partido Animalista Contra el Maltrato Animal | 2,065
83
+ Tarragona | Unió, Progrés i Democràcia | 1,373
84
+ Tarragona | Farts.cat | 1,323
85
+ Tarragona | Pirates de Catalunya | 1,199
86
+ Tarragona | Socialistes i Republicans | 333
87
+ Tarragona | Unificació Comunista d'Espanya | 287