genPoints: genPoints Generates one or two dimensional points. Generates...

Description Usage Arguments Value TODO Examples

View source: R/genPoints.R

Description

Note that if the user chooses to set bounds on one or more dimensions and the parameters and distribution chosen by user generates many poitns outside the bounds, then genPoints() can take a long time to generate the set of points. This is rarely called directly and is wrapped genIdeals and genAlts. genIdeals is further wrapped by genVoters.

Usage

1
2
3
4
5
6
7
8
genPoints(
  numberOfDimensionsGenPoints = 1,
  numberOfPointsGenPoints = 100,
  distributionTypeGenPoints = "unif",
  dimOneBoundsGenPoints = c(-Inf, Inf),
  dimTwoBoundsGenPoints = c(-Inf, Inf),
  distributionParametersGenPoints = c(-1, 1)
)

Arguments

numberOfDimensionsGenPoints

The number of policy dimensions.

numberOfPointsGenPoints

Number of points to generate.

distributionTypeGenPoints

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", "beta", "cauchy", "chisq", "weibull"

dimOneBoundsGenPoints

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.

dimTwoBoundsGenPoints

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.

distributionParametersGenPoints

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).

Value

outIdeals An ideal point matrix that is numVoters x numDimensions

TODO

Add calibration functionality and move this into C++. Maybe add a warning if the user sets bounds and the resampling takes a long time.

Examples

1
2
3
4
5
6
7
8
  genPoints(numberOfDimensionsGenPoints = 2, numberOfPointsGenPoints = 100, distributionTypeGenPoints = "norm", distributionParametersGenPoints = c(0,.2), dimOneBoundsGenPoints = c(0,1), dimTwoBoundsGenPoints = c(-1,1))
  
  genPoints(numberOfDimensionsGenPoints = 2, numberOfPointsGenPoints = 100, distributionTypeGenPoints = "beta", distributionParametersGenPoints = c(.1,.1), dimOneBoundsGenPoints = c(0,1), dimTwoBoundsGenPoints = c(0,1))
  
  genPoints(numberOfDimensionsGenPoints = 1, numberOfPointsGenPoints = 100, distributionTypeGenPoints = "unif", distributionParametersGenPoints = c(-1,1))
  
  
  

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