genCompetitors: genCompetitors Generates a set of Competitors (candidates or...

Description Usage Arguments Value Examples

View source: R/genCompetitors.R

Description

Generates a set of competitors, each with a competitorID number, an initial location using genIdeals, a vote seekign strategy using genStrategy.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
genCompetitors(
  numberOfDimensionsGenCompetitors = 1,
  numberOfCompetitorsGenCompetitors = 3,
  distributionTypeGenCompetitors = "unif",
  distributionParametersGenCompetitors = c(-1, 1),
  dimOneBoundsGenCompetitors = c(-Inf, Inf),
  dimTwoBoundsGenCompetitors = c(-Inf, Inf),
  allHunterGenCompetitors = TRUE,
  probabilityHunterGenCompetitors = 0,
  probabilityAggregatorGenCompetitors = 0,
  probabilityPredatorGenCompetitors = 0
)

Arguments

numberOfDimensionsGenCompetitors

The number of policy dimensions.

numberOfCompetitorsGenCompetitors

Number of competitors to generate.

distributionTypeGenCompetitors

A string identifying the base R discribution to draw the ideal points from. Uses the base R random number generation family of commands rxxxx (see ?distributions). The user should specify the distribution as a string using the standard R abreviation for the distribution (see ?distributions for a list). Currently supported are: "norm", "unif", "binom", "cauchy", "chisq", "weibull"

distributionParametersGenCompetitors

A vector that contains the additional parameters needed by the particular rxxxx function for a distribtuion. (see ?rxxxx where xxxx is a function listed under ?distribution). Example for a Normal(0,1), use: c(0,1).

dimOneBoundsGenCompetitors

A vector that contains the starting and ending poitns of t he first dimension. Example: c(0,1). Defaults to c(-Inf, Inf) if no boundary is provided.

dimTwoBoundsGenCompetitors

A vector that contains the starting and ending poitns of t he first dimension. Example: c(0,1). Defaults to c(-Inf, Inf) if no boundary is provided.

allHunterGenCompetitors

logical If If FALSE (the default) then the distribution of competitor types is determined by the other parameters in this function. If TRUE then all agents will be of the Humter type and will seek votes by first miving at random. If the move increaes vote share then they continue to move in that directon. If the vote share stays the same or decreases then the competitor randomly selects a move that is between 90 and 270 degrees from the direction of their previous move.

probabilityHunterGenCompetitors

scalar [0,1] The probability that any given competitor will have the Hunter type.

probabilityAggregatorGenCompetitors

scalar [0,1] The probability that any given competitor will have the Aggregator type.

probabilityPredatorGenCompetitors

scalar [0,1] The probability that any given competitor will have the Predator type.

numDimsGenCompetitors

scalar Number of policy dimensions. Can be 1 or 2. If this is set to 1, then the salience of that one dimension will be 1 for all voters.

Value

outCompetitorsDataFrame data.frame The competitors data frame will have the following format.

voterID: A numeric identifier unique to the voter. xIdeal: The x coordinate of the voter's ideal point. yIdeal: 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.

Examples

1
2
  genCompetitors(numberOfDimensionsGenCompetitors=1, numberOfCompetitorsGenCompetitors=10, distributionTypeGenCompetitors ="unif", distributionParametersGenCompetitors = c(-1,1), dimOneBoundsGenCompetitors = c(-Inf,Inf), dimTwoBoundsGenCompetitors = c(-Inf,Inf), allHunterGenCompetitors = TRUE, probabilityHunterGenCompetitors = 0, probabilityAggregatorGenCompetitors=0, probabilityPredatorGenCompetitors=0)
 

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