Learn R Programming

wnominate (version 1.2)

generateTestData: Test Data Generator for W-NOMINATE

Description

generateTestData is the function that generates a rollcall object used to test wnominate. The description of the result below is copied from the documentation of package pscl, written by Simon Jackman.

Usage

generateTestData(legislators=20, rcVotes=100, yea=matrix(runif(rcVotes,min=-0.2,max=0.7),nrow=rcVotes), nay=matrix(runif(rcVotes,min=-0.7,max=0.2),nrow=rcVotes), ideal=matrix(rnorm(legislators),nrow=legislators), Beta=15, dimweight=0.5,normal=1, seed = NULL, utility='nominate')

Arguments

legislators
integer, number of Legislators ('n').
rcVotes
integer, number of roll calls ('m').
yea
an m x d matrix of yea locations, where 'd' are the number of dimensions.
nay
an m x d matrix of no locations, where 'd' are the number of dimensions.
ideal
an n x d matrix of legislator ideal points.
Beta
scalar giving beta parameter from W-NOMINATE.
dimweight
d x 1 vector of dimension weights.
normal
integer, '1' generates data using normal probabilities, any other value generates data using logistic probabilities.
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 ``nominate'' or ``qn''. `nominate' allows NOMINATE logit or probit utilities, while ``qn'' allows for quadratic normal utilities to be used when generating the roll call matrix.

Value

An object of class rollcall

See Also

'wnominate', 'nomprob'.

Examples

Run this code
    dat<-generateTestData()
    result<-wnominate(dat,polarity=c(1,2))
    summary(result)
    plot(result)

Run the code above in your browser using DataLab