calcMinkowskiDistanceVotersAlts: calcMinkowskiDistanceVotersAlts Calulate distance using...

Description Usage Arguments Value

View source: R/calcMinkowskiDistanceVotersAlts.R

Description

Takes a voters dataframe and an alternatives dataframe and strips out the relevant parts and feeds them to minkowskiDistanceSets() which is an Rcpp generated function.

Usage

1
2
3
4
calcMinkowskiDistanceVotersAlts(
  votersCalcMinkowskiDistanceVotersAlts,
  alternativesCalcMinkowskiDistanceVotersAlts
)

Arguments

votersCalcMinkowskiDistanceVotersAlts

The voters data frame must have a specific format, and it must be an R data.frame object. There must be at least these 6 variables and they must have the following names. The order of the variables in the data.frame is not important as long as the variables have the proper names.

ID: A numeric identifier unique to the voter. xLocation: The x coordinate of the voter's ideal point. yLocation: The y coordinate of the voter's ideal point. minkoOrder: The Minkowski order of the voters MInkowski metric based utility function. = 1, is City Block. = 2 is Euclidian and 100 = is See ?Minkowski. xSalience: The salience of the x dimension for the voter. The dimension with the lowest salience is normalized to 1 and it is the numerarier, the salience of other dimension is measured in units of the numerarire. ySalience: The salience of the y dimension for the voter. he dimension with the lowest salience is normalized to 1 and it is the numerarier, the salience of other dimension is measured in units of the numerarire. lossOrder: The loss order for the agents utility function. See the parameter lossOrderVector in ?minkowskiUtilitySets().

alternativesCalcMinkowskiDistanceVotersAlts

alternatives data frame generated from genAlternatives() or in the same format.

Value

A numVoters by numAlternitives matrix containing the minkowski distance each voter is from each alternitive.


robiRagan/voteR documentation built on Feb. 27, 2020, 6:48 p.m.