cosfun {polrep} | R Documentation |
Calculates the cosine measure based on a population vector and a vector for the representatives
cosfun(Z,R)
Z |
Population vector |
R |
Vector for the representatives |
Calculates the cosine of a vector of voters and a vector for the representatives. These are the cosine proportionality scores presented by Koppel and Diskin (2009). Given are the '1-cos' values, which are not proper metrics (they do not have the triangle inequality property).
The order of the groups in the population vector and the vector for the representatives needs to be the same. If there are groups A, B, C in the population, both vectors need to cover their proportion in the same order.
cosunf = 1-(∑(Z * R)/(∑(Z^2) * ∑(R^2))^{\frac{1}{2}})
Other routines are implemented in the packages 'tcR', 'SciencesPo' (no longer on CRAN, see https://github.com/danielmarcelino/SciencesPo and the 'Proportionality' measure therein), and 'lsa'.
A single score given the population and representatives
Didier Ruedin
Koppel, M., and A. Diskin. (2009) Measuring disproportionality, volatility and malapportionment: axiomatization and solutions. Social Choice and Welfare 33, no. 2: 281-286.
Farina
, cosine.similarity
, cosine.similarity
, cosine