-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.Rmd
67 lines (51 loc) · 2.53 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
library(knitr)
opts_chunk$set(fig.path = "man/figures/README-")
```
# dwnominate
[![R-CMD-check](https://github.com/wmay/dwnominate/workflows/R-CMD-check/badge.svg)](https://github.com/wmay/dwnominate/actions)
[![Codecov test coverage](https://codecov.io/gh/wmay/dwnominate/branch/master/graph/badge.svg)](https://codecov.io/gh/wmay/dwnominate?branch=master)
[![DOI](https://zenodo.org/badge/48529209.svg)](https://zenodo.org/badge/latestdoi/48529209)
`dwnominate` provides a simplified R interface to the DW-NOMINATE roll call
scaling program, based on the Fortran source code available at [Keith Poole's
website](https://legacy.voteview.com/dw-nominate.htm).
DW-NOMINATE (*D*ynamic *W*eighted *NOMINA*l *T*hree-step *E*stimation) estimates
dynamic models of legislator ideology using roll call votes, and can efficiently
estimate static ideology models across multiple legislative sessions. The
results can be used to measure legislative ideology and polarization over time.
## Installation
Installation requires a Fortran compiler as well as BLAS and LAPACK
libraries. On Windows these are conveniently available as part of
[Rtools](https://cran.r-project.org/bin/windows/Rtools/). MacOS includes BLAS
and LAPACK, so it only requires installing a Fortran compiler. I recommend
following the advice provided by CRAN
[here](https://cran.r-project.org/bin/macosx/tools/). On Linux these will be
installed with the `r-base-dev` library (or the equivalent for your
distribution).
Once the dependencies are satisfied, the package can be installed from R by
running:
```R
install.packages('remotes')
remotes::install_github('wmay/dwnominate')
```
## Running DW-NOMINATE
DW-NOMINATE is run via the `dwnominate` function, which takes as its main
argument a list of `rollcall` objects from the
[pscl](https://cran.r-project.org/package=pscl) package. The package includes
data from the New Hampshire State Senate for use in examples.
```{r example, results='hide', message=FALSE}
library(dwnominate)
data(nhsenate) # a list of `rollcall` objects
results <- dwnominate(nhsenate)
plot(results)
```
The results are returned as a `dwnominate` object with estimates of legislator
and roll call coordinates. Get detailed information about DW-NOMINATE options
with `?dwnominate` and `help(package=dwnominate)`.
## Citation
Please use the citation provided by Zenodo:
[![DOI](https://zenodo.org/badge/48529209.svg)](https://zenodo.org/badge/latestdoi/48529209)