generateTestData: Test Data Generator for W-NOMINATE

Description Usage Arguments Value Author(s) See Also Examples

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

1
2
3
4
5
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

votes

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

n

integer, number of legislators.

m

integer, number of roll call votes.

lopsided

logical vector of length m indicating dropped vote. This is recomputed in wnominate and is never used.

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 rollcall votes, set to NULL.

desc

user-supplied description, set to NULL.

Author(s)

Keith Poole ktpoole@uga.edu

Jeffrey Lewis jblewis@ucla.edu

James Lo lojames@usc.edu

Royce Carroll rcarroll@rice.edu

See Also

'wnominate', 'nomprob'.

Examples

1
2
3
4
    dat<-generateTestData()
    result<-wnominate(dat,polarity=c(1,2))
    summary(result)
    plot(result)

Example output

Loading required package: pscl
Classes and Methods for R developed in the
Political Science Computational Laboratory
Department of Political Science
Stanford University
Simon Jackman
hurdle and zeroinfl functions by Achim Zeileis

## W-NOMINATE Ideal Point Package
## Copyright 2006 -2020
## Keith Poole, Jeffrey Lewis, James Lo, and Royce Carroll
## Support provided by the U.S. National Science Foundation
## NSF Grant SES-0611974


Preparing to run W-NOMINATE...

	Checking data...

		All members meet minimum vote requirements.

		All votes meet minimum lopsidedness requirement.

	Running W-NOMINATE...

		Getting bill parameters...
		Getting legislator coordinates...
		Starting estimation of Beta...
		Getting bill parameters...
		Getting legislator coordinates...
		Starting estimation of Beta...
		Getting bill parameters...
		Getting legislator coordinates...
		Getting bill parameters...
		Getting legislator coordinates...
		Estimating weights...
		Getting bill parameters...
		Getting legislator coordinates...
		Estimating weights...
		Getting bill parameters...
		Getting legislator coordinates...


W-NOMINATE estimation completed successfully.
W-NOMINATE took 0.786 seconds to execute.



SUMMARY OF W-NOMINATE OBJECT
----------------------------

Number of Legislators:	  20 (0 legislators deleted)
Number of Votes:	  100 (0 votes deleted)
Number of Dimensions:	  2
Predicted Yeas:		  908 of 958 (94.8%) predictions correct
Predicted Nays:		  999 of 1042 (95.9%) predictions correct
Correct Classifiction:	  93.85% 95.35%
APRE:			  0.861 0.895
GMP:			  0.867 0.901 


The first 10 legislator estimates are:
             coord1D coord2D
Legislator1    0.977   0.215
Legislator2   -0.953  -0.302
Legislator3    0.976  -0.217
Legislator4   -0.907  -0.421
Legislator5   -0.738  -0.258
Legislator6   -0.948   0.236
Legislator7    0.996   0.050
Legislator8    0.800  -0.113
Legislator9    0.972  -0.016
Legislator10  -0.973   0.202
NULL

wnominate documentation built on May 2, 2019, 4:21 a.m.