Learn R Programming

anominate (version 0.7)

simulateData: Simulated Roll Call Vote Matrices Generated with Normal (Gaussian) or Quadratic Utility for alpha-NOMINATE

Description

simulateData generates a matrix of roll call votes based on the assumption that legislators possess either normal (Gaussian) or quadratic utility functions. The roll call votes can then be analyzed using the alpha-NOMINATE ideal point model. The estimated value of the alpha parameter can then be compared to the known true value (1 for normal (Gaussian) utility, 0 for quadratic utility).

Usage

simulateData(nvotes=500, nlegis=101, seed=123345, utility="normal")

Value

An object of class rollcall

votes

n x m roll call vote matrix in 0/1/NA format.

codes

a list with named components yea, nay, notInLegis and missing, each component a numeric vector (possibly of length 1 and possibly NA), indicating how entries in the votes component of the rollcall object should be considered. This list simply gathers up the values in the yea, nay, notInLegis and missing arguments passed to the function.

n

integer, number of legislators.

m

integer, number of roll call votes.

legis.data

matrix, user-supplied data on legislators, containing data from an ORD file. Legislator names are rownames to this matrix.

vote.data

user-supplied data on roll call votes, set to NULL.

desc

user-supplied description, set to NULL.

source

user-supplied source information, set to NULL.

Arguments

nvotes

integer, number of roll call votes ('m').

nlegis

integer, number of legislators ('n').

seed

a single value, interpreted as an integer, used to set the seed. If seed is NULL, current seed is used.

utility

String set to either ``normal'' or ``quadratic'', specifying the utility function used to generate the roll call data.

Author

Royce Carroll rcarroll@rice.edu

Christopher Hare cdhare@ucdavis.edu

Jeffrey B. Lewis jblewis@ucla.edu

James Lo lo@uni-mannheim.de

Keith T. Poole ktpoole@uga.edu

Howard Rosenthal hl31@nyu.edu

See Also

'anominate','summary.anominate','plot.anominate','densplot.anominate','traceplot.anominate', 'norm_anom', 'quad_anom','rollcall'.

Examples

Run this code
  # \donttest{
  quadratic.data <- simulateData(utility="quadratic") 
  quad_anom <- anominate(quadratic.data, dims=1, polarity=1, 
    nsamp=200, thin=1, burnin=100, random.starts=FALSE, 
    verbose=FALSE, constrain=FALSE)
  # }
  # 'quad_anom' can be retrieved quickly with: 
  data(quad_anom)

  summary(quad_anom)
  plot(quad_anom)

  # \donttest{
  normal.data <- simulateData(utility="normal") 
  norm_anom <- anominate(normal.data, dims=1, polarity=1, 
    nsamp=200, thin=1, burnin=100, random.starts=FALSE, 
    verbose=FALSE, constrain=FALSE)
  # }
  # 'norm_anom' can be retrieved quickly with: 
  data(norm_anom)

  summary(norm_anom)
  plot(norm_anom)

Run the code above in your browser using DataLab