├── .Rbuildignore ├── .gitignore ├── .travis.yml ├── DESCRIPTION ├── Makefile ├── NAMESPACE ├── NEWS.md ├── R ├── aggregate_item_responses.r ├── assertions.r ├── class-control.r ├── class-dgirt_fit.r ├── class-dgirtin.r ├── class-dgmrp_fit.r ├── class-dgo_fit.r ├── constants.r ├── dgirt.r ├── dichotomize_item_responses.r ├── methods-control.r ├── methods-dgirtfit-plot.r ├── methods-dgirtfit-poststratify.r ├── methods-dgirtfit.r ├── methods-dgirtin.r ├── name_helpers.r ├── package.R ├── rake_partial.r ├── restrict_input_data.r ├── reweight_item_responses.r ├── shape.r ├── shape_hierarchical.r ├── toy_dgirt_in.r ├── toy_dgirtfit.r ├── validate_dgirtIn.r └── validate_input_data.r ├── README.Rmd ├── README.html ├── README.md ├── README ├── dgirt_plot-1.png ├── dgirt_plot_ps-1.png ├── dgmrp_plot-1.png ├── dgmrp_plot_plus-1.png └── dgmrp_plot_ps-1.png ├── _pkgdown.yml ├── appveyor.yml ├── codecov.yml ├── cran-comments.md ├── data ├── toy_dgirt_in.rda └── toy_dgirtfit.rda ├── docs ├── articles │ ├── abortion_attitudes.html │ ├── abortion_attitudes_cache │ │ └── html │ │ │ ├── __packages │ │ │ ├── dgmrp_plot_4d97bccd4b58595c19fcc9945abb4081.RData │ │ │ ├── dgmrp_plot_4d97bccd4b58595c19fcc9945abb4081.rdb │ │ │ ├── dgmrp_plot_4d97bccd4b58595c19fcc9945abb4081.rdx │ │ │ ├── dgmrp_plot_ps_48379d5b6e72c0761453109897580e48.RData │ │ │ ├── dgmrp_plot_ps_48379d5b6e72c0761453109897580e48.rdb │ │ │ ├── dgmrp_plot_ps_48379d5b6e72c0761453109897580e48.rdx │ │ │ ├── unnamed-chunk-1_5cb3674302b7dd510debce6a556c99e6.RData │ │ │ ├── unnamed-chunk-1_5cb3674302b7dd510debce6a556c99e6.rdb │ │ │ ├── unnamed-chunk-1_5cb3674302b7dd510debce6a556c99e6.rdx │ │ │ ├── unnamed-chunk-2_d2b3882d4c13b01251e31186e84afb42.RData │ │ │ ├── unnamed-chunk-2_d2b3882d4c13b01251e31186e84afb42.rdb │ │ │ ├── unnamed-chunk-2_d2b3882d4c13b01251e31186e84afb42.rdx │ │ │ ├── unnamed-chunk-3_63bc9e1c24c2c84bc22471384debcfdf.RData │ │ │ ├── unnamed-chunk-3_63bc9e1c24c2c84bc22471384debcfdf.rdb │ │ │ ├── unnamed-chunk-3_63bc9e1c24c2c84bc22471384debcfdf.rdx │ │ │ ├── unnamed-chunk-4_0446b9ea55aac86d4cbaed55d9f02197.RData │ │ │ ├── unnamed-chunk-4_0446b9ea55aac86d4cbaed55d9f02197.rdb │ │ │ ├── unnamed-chunk-4_0446b9ea55aac86d4cbaed55d9f02197.rdx │ │ │ ├── unnamed-chunk-5_2b212393f7107bba7048815f753f7f47.RData │ │ │ ├── unnamed-chunk-5_2b212393f7107bba7048815f753f7f47.rdb │ │ │ ├── unnamed-chunk-5_2b212393f7107bba7048815f753f7f47.rdx │ │ │ ├── unnamed-chunk-6_77653c8f061f6bf4e238e8b425770005.RData │ │ │ ├── unnamed-chunk-6_77653c8f061f6bf4e238e8b425770005.rdb │ │ │ ├── unnamed-chunk-6_77653c8f061f6bf4e238e8b425770005.rdx │ │ │ ├── unnamed-chunk-7_17ef96e7728b26ce39393a638710c244.RData │ │ │ ├── unnamed-chunk-7_17ef96e7728b26ce39393a638710c244.rdb │ │ │ ├── unnamed-chunk-7_17ef96e7728b26ce39393a638710c244.rdx │ │ │ ├── unnamed-chunk-8_dcf5ba59ce6afc2f85982cb3db9db27f.RData │ │ │ ├── unnamed-chunk-8_dcf5ba59ce6afc2f85982cb3db9db27f.rdb │ │ │ ├── unnamed-chunk-8_dcf5ba59ce6afc2f85982cb3db9db27f.rdx │ │ │ ├── unnamed-chunk-9_25fa8d3779010458dc7dc284f28cb49d.RData │ │ │ ├── unnamed-chunk-9_25fa8d3779010458dc7dc284f28cb49d.rdb │ │ │ └── unnamed-chunk-9_25fa8d3779010458dc7dc284f28cb49d.rdx │ ├── abortion_attitudes_files │ │ └── figure-html │ │ │ ├── dgmrp_plot-1.png │ │ │ └── dgmrp_plot_ps-1.png │ ├── index.html │ ├── policy_liberalism.html │ ├── policy_liberalism_cache │ │ └── html │ │ │ ├── __packages │ │ │ ├── dgirt_plot_1ddc8361c9582fd966b2bd4f099bd6a1.RData │ │ │ ├── dgirt_plot_1ddc8361c9582fd966b2bd4f099bd6a1.rdb │ │ │ ├── dgirt_plot_1ddc8361c9582fd966b2bd4f099bd6a1.rdx │ │ │ ├── dgirt_plot_ps_edac3c455ee40136d9b3a133f958a6c8.RData │ │ │ ├── dgirt_plot_ps_edac3c455ee40136d9b3a133f958a6c8.rdb │ │ │ ├── dgirt_plot_ps_edac3c455ee40136d9b3a133f958a6c8.rdx │ │ │ ├── unnamed-chunk-1_7f7f7b7846be6c23b0eac5c9f71dd35d.RData │ │ │ ├── unnamed-chunk-1_7f7f7b7846be6c23b0eac5c9f71dd35d.rdb │ │ │ ├── unnamed-chunk-1_7f7f7b7846be6c23b0eac5c9f71dd35d.rdx │ │ │ ├── unnamed-chunk-2_abe6ef06e1b0721c2f4612946d61d1e1.RData │ │ │ ├── unnamed-chunk-2_abe6ef06e1b0721c2f4612946d61d1e1.rdb │ │ │ ├── unnamed-chunk-2_abe6ef06e1b0721c2f4612946d61d1e1.rdx │ │ │ ├── unnamed-chunk-3_5e042dc3fdbbdb23e9a63b08c31c2db7.RData │ │ │ ├── unnamed-chunk-3_5e042dc3fdbbdb23e9a63b08c31c2db7.rdb │ │ │ ├── unnamed-chunk-3_5e042dc3fdbbdb23e9a63b08c31c2db7.rdx │ │ │ ├── unnamed-chunk-4_48e27a99cc898a34897e047e7c0ff6b9.RData │ │ │ ├── unnamed-chunk-4_48e27a99cc898a34897e047e7c0ff6b9.rdb │ │ │ ├── unnamed-chunk-4_48e27a99cc898a34897e047e7c0ff6b9.rdx │ │ │ ├── unnamed-chunk-5_afac86a88dc31791a80d502b3016574b.RData │ │ │ ├── unnamed-chunk-5_afac86a88dc31791a80d502b3016574b.rdb │ │ │ ├── unnamed-chunk-5_afac86a88dc31791a80d502b3016574b.rdx │ │ │ ├── unnamed-chunk-6_88f945ece342819ae91d0f11859b9523.RData │ │ │ ├── unnamed-chunk-6_88f945ece342819ae91d0f11859b9523.rdb │ │ │ ├── unnamed-chunk-6_88f945ece342819ae91d0f11859b9523.rdx │ │ │ ├── unnamed-chunk-7_4134e80a3b05a719181ae42dc923b9ae.RData │ │ │ ├── unnamed-chunk-7_4134e80a3b05a719181ae42dc923b9ae.rdb │ │ │ ├── unnamed-chunk-7_4134e80a3b05a719181ae42dc923b9ae.rdx │ │ │ ├── unnamed-chunk-8_73631e93f55e8d3fe2110bf282c796e6.RData │ │ │ ├── unnamed-chunk-8_73631e93f55e8d3fe2110bf282c796e6.rdb │ │ │ ├── unnamed-chunk-8_73631e93f55e8d3fe2110bf282c796e6.rdx │ │ │ ├── unnamed-chunk-9_65b67d4e9a07590b8b28a91c94646f7b.RData │ │ │ ├── unnamed-chunk-9_65b67d4e9a07590b8b28a91c94646f7b.rdb │ │ │ └── unnamed-chunk-9_65b67d4e9a07590b8b28a91c94646f7b.rdx │ └── policy_liberalism_files │ │ └── figure-html │ │ ├── dgirt_plot-1.png │ │ └── dgirt_plot_ps-1.png ├── authors.html ├── docsearch.css ├── docsearch.js ├── index.html ├── jquery.sticky-kit.min.js ├── link.svg ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml └── reference │ ├── dgirt.html │ ├── dgirt_fit-class.html │ ├── dgirtfit-class.html │ ├── dgirtin-class.html │ ├── dgmrp_fit-class.html │ ├── dgo.html │ ├── dgo_fit-class.html │ ├── dgo_fit-methods.html │ ├── expand_rownames.html │ ├── index.html │ ├── plot-method.html │ ├── poststratify.html │ ├── shape.html │ ├── toy_dgirt_in.html │ └── toy_dgirtfit.html ├── inst ├── dgirt_details.pdf └── models │ ├── 2017_01_04.stan │ └── 2017_01_04_singleissue.stan ├── man ├── dgirt.Rd ├── dgirt_fit-class.Rd ├── dgirtfit-class.Rd ├── dgirtin-class.Rd ├── dgmrp_fit-class.Rd ├── dgo.Rd ├── dgo_fit-class.Rd ├── dgo_fit-methods.Rd ├── plot-method.Rd ├── poststratify.Rd ├── shape.Rd ├── toy_dgirt_in.Rd └── toy_dgirtfit.Rd ├── tests ├── testthat.R └── testthat │ ├── d_agg_n_vec.Rds │ ├── d_agg_s_vec.Rds │ ├── d_min_n_vec.Rds │ ├── d_min_s_vec.Rds │ ├── dgirt_ret.Rds │ ├── dgmrp_ret.Rds │ ├── setup.r │ ├── test-assertions.r │ ├── test-defaults.r │ ├── test-dgirt.r │ ├── test-dgirtfit.r │ ├── test-dgirtin.r │ ├── test-dichotomize.r │ ├── test-input-validation.r │ ├── test-item_coercion.R │ ├── test-ns_vec.r │ ├── test-plot.r │ ├── test-poststratify.r │ ├── test-raking.r │ ├── test-restrict.r │ ├── test-shape_misc.r │ ├── test-types.r │ ├── test-varnames.r │ ├── test-zz.r │ └── user-version.stan ├── tools ├── example_objects.R └── test_objects.R └── vignettes ├── abortion_attitudes.Rmd ├── abortion_attitudes_cache └── html │ ├── __packages │ ├── dgmrp_plot_d3024781d005ada7e8281178d61d6a61.RData │ ├── dgmrp_plot_d3024781d005ada7e8281178d61d6a61.rdb │ ├── dgmrp_plot_d3024781d005ada7e8281178d61d6a61.rdx │ ├── dgmrp_plot_ps_511a1c935b490935f82473064f919a9f.RData │ ├── dgmrp_plot_ps_511a1c935b490935f82473064f919a9f.rdb │ ├── dgmrp_plot_ps_511a1c935b490935f82473064f919a9f.rdx │ ├── unnamed-chunk-1_1b54e2e0ef1fdbb838541bfdc6f8f170.RData │ ├── unnamed-chunk-1_1b54e2e0ef1fdbb838541bfdc6f8f170.rdb │ ├── unnamed-chunk-1_1b54e2e0ef1fdbb838541bfdc6f8f170.rdx │ ├── unnamed-chunk-2_174a87eca0b3c0bb0a1585ea74cfc6be.RData │ ├── unnamed-chunk-2_174a87eca0b3c0bb0a1585ea74cfc6be.rdb │ ├── unnamed-chunk-2_174a87eca0b3c0bb0a1585ea74cfc6be.rdx │ ├── unnamed-chunk-3_2f2dc23d9b65cc7cd7d679384aa8b06b.RData │ ├── unnamed-chunk-3_2f2dc23d9b65cc7cd7d679384aa8b06b.rdb │ ├── unnamed-chunk-3_2f2dc23d9b65cc7cd7d679384aa8b06b.rdx │ ├── unnamed-chunk-4_52ab4fd35d38a304cb265918d704060f.RData │ ├── unnamed-chunk-4_52ab4fd35d38a304cb265918d704060f.rdb │ ├── unnamed-chunk-4_52ab4fd35d38a304cb265918d704060f.rdx │ ├── unnamed-chunk-5_fc906da652962bd2049d905b371c9761.RData │ ├── unnamed-chunk-5_fc906da652962bd2049d905b371c9761.rdb │ ├── unnamed-chunk-5_fc906da652962bd2049d905b371c9761.rdx │ ├── unnamed-chunk-6_16ef36c67b636e48629cd8e0ece84a75.RData │ ├── unnamed-chunk-6_16ef36c67b636e48629cd8e0ece84a75.rdb │ ├── unnamed-chunk-6_16ef36c67b636e48629cd8e0ece84a75.rdx │ ├── unnamed-chunk-7_4d12c28894575a3a1d9d9f0867c9da45.RData │ ├── unnamed-chunk-7_4d12c28894575a3a1d9d9f0867c9da45.rdb │ ├── unnamed-chunk-7_4d12c28894575a3a1d9d9f0867c9da45.rdx │ ├── unnamed-chunk-8_3b137cfdaf9edf395e4237e734c04e1b.RData │ ├── unnamed-chunk-8_3b137cfdaf9edf395e4237e734c04e1b.rdb │ ├── unnamed-chunk-8_3b137cfdaf9edf395e4237e734c04e1b.rdx │ ├── unnamed-chunk-9_70cca80e7b4dc91963e597745772228e.RData │ ├── unnamed-chunk-9_70cca80e7b4dc91963e597745772228e.rdb │ └── unnamed-chunk-9_70cca80e7b4dc91963e597745772228e.rdx ├── policy_liberalism.Rmd └── policy_liberalism_cache └── html ├── __packages ├── dgirt_plot_b4fa5eae7ac78a096972b07acb34f1f5.RData ├── dgirt_plot_b4fa5eae7ac78a096972b07acb34f1f5.rdb ├── dgirt_plot_b4fa5eae7ac78a096972b07acb34f1f5.rdx ├── dgirt_plot_ps_e677377f0eecb9170d1d44ae8ae519b7.RData ├── dgirt_plot_ps_e677377f0eecb9170d1d44ae8ae519b7.rdb ├── dgirt_plot_ps_e677377f0eecb9170d1d44ae8ae519b7.rdx ├── unnamed-chunk-1_556f792b879b73520d1579b54f883f36.RData ├── unnamed-chunk-1_556f792b879b73520d1579b54f883f36.rdb ├── unnamed-chunk-1_556f792b879b73520d1579b54f883f36.rdx ├── unnamed-chunk-2_9d7055b643b182a7faa7312f609d403c.RData ├── unnamed-chunk-2_9d7055b643b182a7faa7312f609d403c.rdb ├── unnamed-chunk-2_9d7055b643b182a7faa7312f609d403c.rdx ├── unnamed-chunk-3_ecef3683b1a3cb87e32babeb21b827b0.RData ├── unnamed-chunk-3_ecef3683b1a3cb87e32babeb21b827b0.rdb ├── unnamed-chunk-3_ecef3683b1a3cb87e32babeb21b827b0.rdx ├── unnamed-chunk-4_f98071591ab4f9cc37793edfc38d0660.RData ├── unnamed-chunk-4_f98071591ab4f9cc37793edfc38d0660.rdb ├── unnamed-chunk-4_f98071591ab4f9cc37793edfc38d0660.rdx ├── unnamed-chunk-5_7a37ae57bb5125deaa756983c299cd51.RData ├── unnamed-chunk-5_7a37ae57bb5125deaa756983c299cd51.rdb ├── unnamed-chunk-5_7a37ae57bb5125deaa756983c299cd51.rdx ├── unnamed-chunk-6_d654b70fc50aa8a6a560b061c4a6ec58.RData ├── unnamed-chunk-6_d654b70fc50aa8a6a560b061c4a6ec58.rdb ├── unnamed-chunk-6_d654b70fc50aa8a6a560b061c4a6ec58.rdx ├── unnamed-chunk-7_6f9dfb97b6fc0536dc167992916642a9.RData ├── unnamed-chunk-7_6f9dfb97b6fc0536dc167992916642a9.rdb ├── unnamed-chunk-7_6f9dfb97b6fc0536dc167992916642a9.rdx ├── unnamed-chunk-8_d0e24fb7bb62e382ff8edfda5f69614d.RData ├── unnamed-chunk-8_d0e24fb7bb62e382ff8edfda5f69614d.rdb ├── unnamed-chunk-8_d0e24fb7bb62e382ff8edfda5f69614d.rdx ├── unnamed-chunk-9_8d21b4c4bd700275410cd61340d5c688.RData ├── unnamed-chunk-9_8d21b4c4bd700275410cd61340d5c688.rdb └── unnamed-chunk-9_8d21b4c4bd700275410cd61340d5c688.rdx /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rdata$ 2 | ^.*\.Rproj$ 3 | ^.*tar.gz$ 4 | ^Makefile$ 5 | ^README.Rmd$ 6 | ^README.html$ 7 | ^README/ 8 | ^\.DS_Store$ 9 | ^\.Rproj\.user$ 10 | ^\.travis\.yml$ 11 | ^_pkgdown.yml$ 12 | ^appveyor\.yml$ 13 | ^codecov\.yml$ 14 | ^cran-comments\.md$ 15 | ^docs/ 16 | ^readme-cache/ 17 | ^vignettes/ 18 | ^wercker\.yml$ 19 | ^_pkgdown\.yml$ 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | dgo.Rcheck/ 3 | *.tar.gz 4 | readme-cache 5 | src/*.o 6 | src/*.so 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: r 2 | cache: packages 3 | matrix: 4 | include: 5 | 6 | - os: linux 7 | dist: trusty 8 | r: release 9 | sudo: required 10 | - os: linux 11 | dist: trusty 12 | r: devel 13 | sudo: required 14 | - os: linux 15 | dist: trusty 16 | r: oldrel 17 | sudo: required 18 | 19 | - os: osx 20 | osx_image: xcode8.3 21 | latex: false 22 | r: release 23 | - os: osx 24 | osx_image: xcode8.3 25 | latex: false 26 | r: oldrel 27 | - os: osx 28 | latex: false 29 | - os: osx 30 | latex: false 31 | r: release 32 | - os: osx 33 | latex: false 34 | r: oldrel 35 | 36 | notifications: 37 | email: 38 | - jdunham@mit.edu 39 | r_github_packages: 40 | - jimhester/covr 41 | after_success: 42 | - Rscript -e 'library(covr); codecov()' 43 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: dgo 2 | Title: Dynamic Estimation of Group-Level Opinion 3 | Version: 0.2.15 4 | Date: 2018-07-16 5 | Description: Fit dynamic group-level item response theory (IRT) and multilevel 6 | regression and poststratification (MRP) models from item response data. dgo 7 | models latent traits at the level of demographic and geographic groups, 8 | rather than individuals, in a Bayesian group-level IRT approach developed by 9 | Caughey and Warshaw (2015) . The package also 10 | estimates subpopulations' average responses to single survey items with a 11 | dynamic MRP model proposed by Park, Gelman, and Bafumi (2004) 12 | . 13 | Maintainer: James Dunham 14 | Authors@R: c( 15 | person("James", "Dunham", email = "james@jdunham.io", role = c("aut", "cre")), 16 | person("Devin", "Caughey", email = "caughey@mit.edu", role = c("aut")), 17 | person("Christopher", "Warshaw", email = "cwarshaw@mit.edu", role = c("aut")) 18 | ) 19 | License: GPL-3 20 | URL: https://jdunham.io/dgo/ 21 | BugReports: https://github.com/jamesdunham/dgo/issues 22 | Depends: 23 | dgodata, 24 | R (>= 3.2.2), 25 | rstan (>= 2.15.1) 26 | LazyData: true 27 | Imports: 28 | assertthat, 29 | data.table, 30 | ggplot2, 31 | lubridate, 32 | methods, 33 | R6, 34 | survey 35 | Suggests: 36 | knitr, 37 | reshape2, 38 | rmarkdown, 39 | testthat 40 | Collate: 41 | 'aggregate_item_responses.r' 42 | 'assertions.r' 43 | 'class-control.r' 44 | 'class-dgo_fit.r' 45 | 'class-dgirt_fit.r' 46 | 'constants.r' 47 | 'class-dgirtin.r' 48 | 'class-dgmrp_fit.r' 49 | 'dgirt.r' 50 | 'dichotomize_item_responses.r' 51 | 'methods-control.r' 52 | 'methods-dgirtfit-plot.r' 53 | 'methods-dgirtfit-poststratify.r' 54 | 'methods-dgirtfit.r' 55 | 'methods-dgirtin.r' 56 | 'name_helpers.r' 57 | 'package.R' 58 | 'rake_partial.r' 59 | 'restrict_input_data.r' 60 | 'reweight_item_responses.r' 61 | 'shape.r' 62 | 'shape_hierarchical.r' 63 | 'toy_dgirt_in.r' 64 | 'toy_dgirtfit.r' 65 | 'validate_dgirtIn.r' 66 | 'validate_input_data.r' 67 | RoxygenNote: 6.0.1 68 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PKG := $(shell head -1 DESCRIPTION | sed 's/Package: //' | cat) 2 | VERSION := $(shell sed -n 3p DESCRIPTION | sed 's/Version: //' | cat) 3 | BINARY := $(PKG)_$(VERSION).tar.gz 4 | MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) 5 | CURRENT_DIR := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))) 6 | R_ARGS := --no-site-file --no-environ --no-save \ 7 | --no-restore --no-resave-data --no-manual --quiet 8 | ifneq (, $(findstring r-devel,$(CURRENT_DIR))) 9 | R := Rdevel.sh 10 | else 11 | R := R 12 | endif 13 | 14 | all: clean docs data readme build check install site 15 | 16 | quick: clean 17 | 18 | clean: 19 | @rm -rf src/*.so src/*.o *tar.gz *Rcheck* 20 | 21 | build: 22 | $(R) $(R_ARGS) CMD build . 23 | 24 | build-cran: 25 | $(R) CMD build . --no-resave-data --no-manual 26 | 27 | check: 28 | $(R) CMD check $(BINARY) 29 | 30 | check-cran: 31 | $(R) CMD check --as-cran $(BINARY) 32 | 33 | check-quick $(BINARY): 34 | $(R) $(R_ARGS) CMD build . 35 | $(R) CMD check $(BINARY) 36 | 37 | install: $(BINARY) 38 | $(R) CMD INSTALL --no-multiarch --with-keep.source $(BINARY) 39 | 40 | install-code: 41 | $(R) CMD INSTALL --no-multiarch --with-keep.source --no-docs . 42 | 43 | install-quick: 44 | $(R) CMD INSTALL --no-multiarch --no-docs --no-html \ 45 | --with-keep.source . 46 | 47 | readme: README.Rmd 48 | $(R) --vanilla --slave -e "rmarkdown::render('README.Rmd')" 49 | 50 | docs: 51 | $(R) --vanilla --slave -e "devtools::document()" 52 | 53 | data: 54 | Rscript --vanilla --slave tools/example_objects.R 55 | Rscript --vanilla --slave tools/test_objects.R 56 | 57 | site: 58 | $(R) --vanilla --slave -e "pkgdown::build_site()" 59 | 60 | .PHONY: clean docs data 61 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(as.data.frame,dgo_fit) 4 | export(dgirt) 5 | export(dgmrp) 6 | export(plot_rhats) 7 | export(shape) 8 | export(summarize) 9 | exportClasses(dgo_fit) 10 | exportMethods(dgirt_plot) 11 | exportMethods(get_item_n) 12 | exportMethods(get_item_names) 13 | exportMethods(get_n) 14 | exportMethods(get_posterior_mean) 15 | exportMethods(plot) 16 | exportMethods(plot_rhats) 17 | exportMethods(poststratify) 18 | exportMethods(rhats) 19 | exportMethods(show) 20 | exportMethods(summarize) 21 | exportMethods(summary) 22 | import(R6) 23 | import(data.table) 24 | import(dgodata) 25 | import(ggplot2) 26 | import(methods) 27 | import(rstan) 28 | importFrom(lubridate,seconds_to_period) 29 | importFrom(stats,as.formula) 30 | importFrom(stats,formula) 31 | importFrom(stats,model.frame) 32 | importFrom(stats,model.matrix) 33 | importFrom(stats,na.fail) 34 | importFrom(stats,na.omit) 35 | importFrom(stats,pnorm) 36 | importFrom(stats,quantile) 37 | importFrom(stats,sd) 38 | importFrom(stats,setNames) 39 | importFrom(stats,weighted.mean) 40 | importFrom(stats,weights) 41 | importFrom(utils,capture.output) 42 | importFrom(utils,packageVersion) 43 | importFrom(utils,type.convert) 44 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | ## dgo 0.2.15 2 | 3 | * The `group_names` argument to `plot_dgirt()` has been replaced by argument 4 | `group_name`, which takes the name of a single grouping variable. This is a 5 | quick workaround for compatibility with breaking changes in ggplot2 3.0.0. 6 | 7 | ## dgo 0.2.14 8 | 9 | * Avoid an error during testing, on R built `--without-long-double`. 10 | 11 | ## dgo 0.2.13 12 | 13 | * Fix an issue introduced in v0.2.12 that led to an unexpected error in 14 | `shape()` when 1) at least two `group_names` are specified in an order other 15 | than alphabetic and 2) geographic `modifier_data` is used. 16 | 17 | ## dgo 0.2.12 18 | 19 | * Allow modeling of unobserved groups using aggregated data. The previous 20 | behavior was to drop rows in `aggregate_data` indicating zero trials. (They 21 | don't represent item responses.) Preserving them has the effect that 22 | unobserved groups, defined partially or entirely by the values of the grouping 23 | variables in zero-trial rows in `aggregate_data`, can be included in a model. 24 | * Fix an unexpected error when 1) `aggregate_data` is used without `item_data`, 2) 25 | no demographic groups are specified via `group_names`, and 3) geographic 26 | `modifier_data` is used. 27 | * Fix the check for missing `modifier_data`. Geographic `modifier_data` must 28 | cover all combinations of the geo and time variables in the item response data 29 | (individual or aggregated), but because of a bug in the validation of the 30 | geographic data, this requirement was not always enforced. In some cases a 31 | warning would appear instead of an error. 32 | 33 | ## dgo 0.2.11 34 | 35 | * Add poststratification over posterior samples (closes #21). 36 | * `shape()` now accepts aggregated item response data unaccompanied by 37 | individual-level item response data. The `item_data` and `item_names` 38 | arguments are no longer required. 39 | * Add a `max_raked_weight` argument to `shape()` for trimming raked weights. 40 | Note that trimming occurs before raked weights are rescaled to have mean 1, 41 | and the rescaled weights can be larger than `max_raked_weight`. 42 | * Remove the unused function `expand_rownames()`. 43 | * Bugfixes. 44 | 45 | ## dgo 0.2.10 46 | 47 | * Remove Rcpp dependency by rewriting `dichotomize()` in R. 48 | * Avoid estimating models (using RStan) during tests, with the goal of rendering 49 | moot variation in build environments. This addresses a test failure during 50 | CRAN's 51 | [r-release-osx-x86_64](https://www.r-project.org/nosvn/R.check/r-release-osx-x86_64/dgo-00check.html) 52 | build. 53 | 54 | ## dgo 0.2.9 55 | 56 | * Switch from compiling Stan models at install time to compiling them at 57 | runtime, avoiding an Rcpp module issue. 58 | * Add `model` argument to `dgirt()` and `dgmrp()` taking for reuse a previously 59 | compiled Stan model, as found in the `@stanmodel` slot of a `dgirt_fit`- or 60 | `dgmrp_fit`-class object. 61 | * The `version` argument to `dgirt()` and `dgmrp()` can be used to specify 62 | arbitrary `.stan` files on the disk in addition to those included with the 63 | package. 64 | * Argument `by` to `get_n()` and `get_item_n()` methods properly accepts a 65 | vector of variable names when combined with `aggregate` arguments. 66 | 67 | ## dgo 0.2.8 68 | 69 | * Improve Stan models for shorter run times 70 | * Add `dgmrp()` for fitting single-issue MRP models with hierarchical covariates 71 | * Add class `dgmrp_fit` for models fitted with `dgmrp()`, inheriting from a new 72 | virtual class `dgo_fit` 73 | * `dgirt()` now returns a `dgirt_fit`-class object that also inherits from 74 | `dgo_fit` class 75 | * Bugfixes 76 | 77 | ## dgo 0.2.7 78 | 79 | * Package renamed dgo: Dynamic Estimation of Group-level Opinion 80 | * Tweaks to pass CRAN checks: clean up examples and docs 81 | * Use roxygen2 for classes, methods, and `NAMESPACE` 82 | * Fix checks on `P`, `S` related to `group_names` change in 0.2.5 83 | * Fix Rcpp module issue from 0.2.6 (`Error in .doLoadActions(where, attach)`) 84 | * Export `expand_rownames()` 85 | 86 | ## dgo 0.2.6 87 | 88 | * Fix error in `dgirt_plot` 89 | * Fix path in `tools/make_cpp.R` 90 | 91 | ## dgo 0.2.5 92 | 93 | * `group_names` is no longer required. If omitted, the geographic variable given 94 | by `geo_name` will define groups. 95 | * `aggregate_item_names` is no longer required. It defaults to the observed 96 | values of the `item` column in `aggregate_data`. 97 | * `raking` argument to `shape()` replaces `strata_names`. It takes a formula or 98 | list of formulas and allows more complicated preweighting. 99 | * `id_vars` argument to `shape()` specifies variables to be kept in `item_data`. 100 | * `aggregate_data` may include geographic areas, demographics, or time periods 101 | that don't appear in `item_data`. 102 | * Fix: use a smaller epsilon than the default in survey::rake() for convergence 103 | with non-frequency weights. 104 | * New `dgirtfit` methods `rhats()` and `plot_rhats()` for model checking. 105 | * New `dgirtfit` method `get_time_elapsed` gives model run times. These also 106 | appear in `summary` output. 107 | -------------------------------------------------------------------------------- /R/assertions.r: -------------------------------------------------------------------------------- 1 | assert <- assertthat::assert_that 2 | 3 | all_equal <- function(x, y) { 4 | isTRUE(all.equal(x, y)) 5 | } 6 | 7 | assertthat::on_failure(all_equal) <- function(call, env) { 8 | paste0(deparse(call$x), " and ", deparse(call$y), " are not all equal") 9 | } 10 | 11 | equal_length = function(x, y) { 12 | assertthat::are_equal(length(x), length(y)) 13 | } 14 | 15 | assertthat::on_failure(equal_length) <- function(call, env) { 16 | paste0(deparse(call$x), " and ", deparse(call$y), " have different lengths") 17 | } 18 | 19 | is_subset <- function(x, y) { 20 | all(unique(x) %in% unique(y)) 21 | } 22 | 23 | assertthat::on_failure(is_subset) <- function(call, env) { 24 | paste0(deparse(call$x), " is not a subset of ", deparse(call$y)) 25 | } 26 | 27 | not_empty <- function(x) { 28 | assertthat::not_empty(x) 29 | } 30 | 31 | assertthat::on_failure(not_empty) <- function(call, env) { 32 | paste0("empty dimension in ", deparse(call$x)) 33 | } 34 | 35 | has_all_names <- function(table, names, suggestion = NULL) { 36 | assertthat::assert_that(assertthat::not_empty(table), assertthat::not_empty(names)) 37 | which_has_name <- vapply(names, function(i) { 38 | assertthat::has_name(table, i) 39 | }, logical(1), USE.NAMES = FALSE) 40 | all(which_has_name) 41 | } 42 | 43 | assertthat::on_failure(has_all_names) <- function(call, env) { 44 | paste0("not all of ", deparse(call$names), " are names in ", deparse(call$table)) 45 | } 46 | 47 | all_strings <- function(x) { 48 | if (length(x) < 1) return(FALSE) 49 | which_strings <- vapply(x, function(i) { 50 | assertthat::is.string(i) && nchar(i) > 0 51 | }, logical(1)) 52 | all(which_strings) 53 | } 54 | 55 | assertthat::on_failure(all_strings) <- function(call, env) { 56 | paste0(deparse(call$x), " are not all positive-length strings") 57 | } 58 | -------------------------------------------------------------------------------- /R/class-control.r: -------------------------------------------------------------------------------- 1 | setClass("Control", 2 | slots = list(item_names = "ANY", 3 | time_name = "character", 4 | geo_name = "character", 5 | group_names = "ANY", 6 | id_vars = "ANY", 7 | # restrictions 8 | time_filter = "ANY", 9 | geo_filter = "ANY", 10 | min_t_filter = "numeric", 11 | min_survey_filter = "numeric", 12 | survey_name = "ANY", 13 | # aggregate data 14 | aggregate_item_names = "ANY", 15 | # modifier data 16 | modifier_names = "ANY", 17 | t1_modifier_names = "ANY", 18 | standardize = "logical", 19 | # target data 20 | raking = "ANY", 21 | weight_name = "ANY", 22 | proportion_name = "character", 23 | rake_names = "character", 24 | max_raked_weight = "ANY", 25 | # modeling options 26 | constant_item = "logical", 27 | # indicators for state 28 | has_individual_data = "ANY", 29 | has_aggregate_data = "ANY", 30 | has_target_data = "ANY", 31 | has_modifier_data = "ANY"), 32 | validity = function(object) { 33 | if (!length(object@time_name) == 1L) 34 | "\"time_name\" should be a single variable name" 35 | else if (!length(object@geo_name) == 1L) 36 | "\"geo_name\" should be a single variable name" 37 | else if (length(object@item_names) && !is.character(object@item_names)) 38 | "if specified \"item_names\" should give variable names in a character vector" 39 | else if (length(object@survey_name) && length(object@survey_name) != 1L) 40 | "if specified \"survey_name\" should be a single variable name" 41 | else if (length(object@survey_name) && !is.character(object@survey_name)) 42 | "if specified \"survey_name\" should be a single variable name" 43 | else if (length(object@group_names) && !is.character(object@group_names)) 44 | "if specified \"group_names\" should give variable names in a character vector" 45 | else if (length(object@modifier_names) && !is.character(object@modifier_names)) 46 | "if specified \"modifier_names\" should give variable names in a character vector" 47 | else if (length(object@t1_modifier_names) && !is.character(object@t1_modifier_names)) 48 | "if specified \"t1_modifier_names\" should give variable names in a character vector" 49 | else if (length(object@id_vars) && !is.character(object@id_vars)) 50 | "if specified \"id_vars\" should give variable names in a character vector" 51 | else if (length(object@time_filter) && !is.numeric(object@time_filter)) 52 | "if specified \"time_filter\" should give numeric values of the `time_name` variable" 53 | else if (length(object@geo_filter) && !is.character(object@geo_filter)) 54 | "if specified \"geo_filter\" should give character values of the `geo_name` variable" 55 | else if (length(object@aggregate_item_names) && !is.character(object@aggregate_item_names)) 56 | "if specified \"aggregate_item_names\" should give values in an \"item\" column of aggregate_data" 57 | else if (!length(object@standardize) == 1L) 58 | "\"standardize\" should be a single logical" 59 | else if (length(object@weight_name) && !is.character(object@weight_name)) 60 | "if specified \"weight_name\" should be a single variable name" 61 | else if (length(object@weight_name) > 1) 62 | "if specified \"weight_name\" should be a single variable name" 63 | else if (length(object@proportion_name) && length(object@proportion_name) != 1L) 64 | "if specified \"proportion_name\" should be a single variable name" 65 | else if (length(object@raking) && !is.list(object@raking) & 66 | !"formula" %in% class(object@raking)) 67 | "\"raking\" should be a formula or a list of formulas" 68 | else if (length(object@raking) && is.list(object@raking) && 69 | !all(sapply(object@raking, class) %in% "formula")) 70 | "\"raking\" should be a formula or a list of formulas" 71 | else if (!length(object@constant_item) == 1L && 72 | is.logical(object@constant_item)) 73 | "\"constant_item\" should be a single logical value" 74 | else if (length(unique(object@geo_filter)) == 1L) 75 | "if specified \"geo_filter\" should give at least two local geographic areas" 76 | else if (length(object@min_survey_filter) != 1L || object@min_survey_filter <= 0L) 77 | "\"min_survey_filter\" should be a positive integer" 78 | else if (!length(object@min_t_filter) == 1L && object@min_t_filter > 0L) 79 | "\"min_t_filter\" should be a positive integer" 80 | else if (length(object@max_raked_weight) && 81 | (length(object@max_raked_weight) > 1 | 82 | !is.numeric(object@max_raked_weight))) { 83 | "if specified \"max_raked_weight\" should be a single number" 84 | } 85 | else 86 | TRUE 87 | }) 88 | -------------------------------------------------------------------------------- /R/class-dgirt_fit.r: -------------------------------------------------------------------------------- 1 | #' A class for fitted dynamic group IRT models 2 | #' 3 | #' \code{\link{dgirt}} returns a fitted model object of class \code{dgirt_fit}, 4 | #' which inherits from \code{\link{dgo_fit}}. 5 | #' 6 | #' dgo 0.2.8 deprecated the \code{dgirtfit} class and replaced it with the 7 | #' \code{\link{dgirt_fit}} class. 8 | #' 9 | #' @slot dgirt_in \code{\link{dgirtin-class}} data used to fit the model. 10 | #' 11 | #' @aliases dgirt_fit dgirt_fit-class 12 | #' @seealso \code{\link{dgmrp_fit}} \code{\link{dgo_fit}} 13 | #' @name dgirt_fit-class 14 | #' @include class-dgo_fit.r 15 | #' @examples 16 | #' data(toy_dgirtfit) 17 | #' # summarize the fitted results 18 | #' summary(toy_dgirtfit, pars = 'xi') 19 | #' 20 | #' # get posterior means with a convenience function 21 | #' get_posterior_mean(toy_dgirtfit, pars = 'theta_bar') 22 | #' 23 | #' # generally apply functions to posterior samples after warmup; n.b. 24 | #' # `as.array` is iterations x chains x parameters so `MARGIN = 3` applies 25 | #' # `FUN` over iterations and chains 26 | #' apply(as.array(toy_dgirtfit, pars = 'xi'), 3, mean) 27 | #' 28 | #' # access the posterior samples 29 | #' head(as.data.frame(toy_dgirtfit, pars = 'theta_bar')) 30 | dgirt_fit <- setClass("dgirt_fit", contains = c("dgo_fit")) 31 | 32 | #' A class for fitted dynamic group IRT models 33 | #' 34 | #' dgo 0.2.8 deprecated the \code{dgirtfit} class and replaced it with the 35 | #' \code{\link{dgirt_fit}} class. 36 | #' 37 | #' @name dgirtfit-class 38 | #' @aliases dgirtfit dgirtfit-class 39 | dgirtfit <- setClass("dgirtfit", contains = c("dgirt_fit")) 40 | -------------------------------------------------------------------------------- /R/class-dgirtin.r: -------------------------------------------------------------------------------- 1 | #' A class for data ready to model 2 | #' 3 | #' \code{shape()} generates objects of class \code{dgirtIn} for modeling with 4 | #' \code{dgirt()} and \code{dgmrp()}. 5 | #' 6 | #' @aliases dgirtin-class, get_item_n, get_item_names, get_n, dgirtIn-method, 7 | #' print.dgirtIn, 8 | #' @name dgirtin-class 9 | #' @include constants.r 10 | #' @import R6 11 | #' @examples 12 | #' data(toy_dgirt_in) 13 | #' get_item_names(toy_dgirt_in) 14 | #' get_n(toy_dgirt_in) 15 | #' get_n(toy_dgirt_in, by = "year") 16 | #' get_n(toy_dgirt_in, by = "source") 17 | #' get_item_n(toy_dgirt_in) 18 | #' get_item_n(toy_dgirt_in, by = "year") 19 | NULL 20 | 21 | setOldClass("dgirtIn", "R6") 22 | dgirtIn <- R6::R6Class("dgirtIn", 23 | public = c( 24 | # model objects (N, G, T, ...) and shape objects (item_data, etc.) are 25 | # public and initially NULL 26 | setNames(lapply(c(model_objects, shape_objects), function(x) NULL), 27 | c(model_objects, shape_objects)), 28 | # the class is instantiated from a Control object 29 | initialize = function(ctrl) { 30 | if (length(ctrl@constant_item)) { 31 | self$constant_item <- ctrl@constant_item 32 | } 33 | self$mod_par_names <- c(ctrl@geo_name, ctrl@time_name) 34 | self$unmod_par_names <- ctrl@group_names 35 | }, 36 | # the as_list method extracts attributes used in modeling as expected by 37 | # rstan. its arguments will be passed from a dgirt or dgmrp call 38 | as_list = function(separate_t, delta_tbar_prior_mean, delta_tbar_prior_sd, 39 | innov_sd_delta_scale, innov_sd_theta_scale, hierarchical_model) { 40 | 41 | # model_objects is a character vector of attribute names for rstan data 42 | d_in_list <- Map(function(x) self[[x]], private$model_objects) 43 | 44 | # separate_t is a boolean in the stan code 45 | if (length(separate_t) != 1L || !is.logical(separate_t)) { 46 | stop("\"separate_t\" should be a single logical value") 47 | } 48 | d_in_list$separate_t <- separate_t 49 | 50 | # hierarchical_model is also boolean in the stan code 51 | if (length(hierarchical_model) != 1L || !is.logical(hierarchical_model)) { 52 | stop("\"hierarchical_model\" should be a single logical value") 53 | } 54 | d_in_list$hierarchical_model <- hierarchical_model 55 | 56 | if (length(delta_tbar_prior_mean) != 1L || !is.numeric(delta_tbar_prior_mean)) { 57 | stop("\"delta_tbar_prior_mean\" should be a single real value") 58 | } 59 | d_in_list$delta_tbar_prior_mean <- delta_tbar_prior_mean 60 | 61 | if (length(delta_tbar_prior_sd) != 1L || !is.numeric(delta_tbar_prior_sd) 62 | || delta_tbar_prior_sd < 0) 63 | { 64 | stop("\"delta_tbar_prior_sd\" should be a single positive real value") 65 | } 66 | d_in_list$delta_tbar_prior_sd <- delta_tbar_prior_sd 67 | 68 | if (length(innov_sd_delta_scale) != 1L || 69 | !is.numeric(innov_sd_delta_scale) || innov_sd_delta_scale < 0) { 70 | stop("\"innov_sd_delta_scale\" should be a single real value") 71 | } 72 | d_in_list$innov_sd_delta_scale <- innov_sd_delta_scale 73 | 74 | if (length(innov_sd_theta_scale ) != 1L || 75 | !is.numeric(innov_sd_theta_scale) || innov_sd_theta_scale < 0) { 76 | stop("\"innov_sd_theta_scale\" should be a single positive real value") 77 | } 78 | d_in_list$innov_sd_theta_scale <- innov_sd_theta_scale 79 | 80 | d_in_list 81 | }), 82 | # keep track of which items will be used in modeling 83 | private = list(model_objects = model_objects, shape_objects = shape_objects)) 84 | -------------------------------------------------------------------------------- /R/class-dgmrp_fit.r: -------------------------------------------------------------------------------- 1 | #' A class for fitted dynamic group MRP models 2 | #' 3 | #' \code{\link{dgmrp}} returns a fitted model object of class \code{dgmrp_fit}, 4 | #' which inherits from \code{\link{dgo_fit}}. 5 | #' 6 | #' @slot dgirt_in \code{\link{dgirtin-class}} data used to fit the model. 7 | #' 8 | #' @aliases dgmrp_fit dgmrp_fit-class 9 | #' @seealso \code{\link{dgirt_fit}} \code{\link{dgo_fit}} 10 | #' @include class-dgo_fit.r 11 | #' @name dgmrp_fit-class 12 | dgmrp_fit <- setClass("dgmrp_fit", contains = "dgo_fit") 13 | -------------------------------------------------------------------------------- /R/class-dgo_fit.r: -------------------------------------------------------------------------------- 1 | #' A class for fitted models 2 | #' 3 | #' \code{dgo_fit} is a superclass for \code{\link{dgirt_fit}} and 4 | #' \code{\link{dgmrp_fit}} that inherits from the 5 | #' \code{\link[rstan]{stanfit-class}} in the \code{\link{rstan}} package. 6 | #' 7 | #' @slot dgirt_in \code{\link{dgirtin-class}} data used to fit the model. 8 | #' @slot call The function call that returned the \code{dgo_fit} object. 9 | #' 10 | #' @aliases dgo_fit dgo_fit-class 11 | #' @seealso \code{\link{dgmrp_fit}} \code{\link{dgo_fit}} 12 | #' @name dgo_fit-class 13 | #' @export 14 | dgo_fit <- setClass("dgo_fit", contains = "stanfit", 15 | slots = list(dgirt_in = "ANY", call = "language")) 16 | -------------------------------------------------------------------------------- /R/constants.r: -------------------------------------------------------------------------------- 1 | model_objects <- c("NNl2", "SSl2", "XX", "ZZ", "ZZ_prior", "G", "Q", "T", "N", 2 | "P", "S", "H", "D", "Hprior", "WT", "l2_only", "G_hier", 3 | "constant_item", "n_vec", "s_vec", "observed", "N_observed") 4 | 5 | shape_objects <- c("gt_items", "group_grid", "group_grid_t", "group_counts", 6 | "item_data", "target_data", "aggregate_data", "modifier_data", 7 | "control", "hier_names", "call", "mod_par_names", 8 | "unmod_par_names", "pkg_version") 9 | 10 | dgirt_pars <- c("separate_t", "delta_tbar_prior_mean", "delta_tbar_prior_sd", 11 | "innov_sd_delta_scale", "innov_sd_theta_scale", "version", 12 | "hierarchical_model") 13 | 14 | dgmrp_pars <- setdiff(dgirt_pars, "hierarchical_model") 15 | 16 | default_pars <- c("theta_bar", "xi", "gamma", "delta_gamma", "delta_tbar", 17 | "nu_geo", "nu_geo_prior", "kappa", "sd_item", "sd_theta", 18 | "sd_theta_bar", "sd_gamma_geo", "sd_gamma_demo", 19 | "sd_innov_gamma", "sd_innov_delta", "sd_innov_logsd", 20 | "sd_total") 21 | 22 | default_pars_mrp <- c("theta_bar", "xi", "gamma", "delta_gamma", "delta_tbar", 23 | "nu_geo", "nu_geo_prior", "sd_theta_bar", "sd_gamma_geo", "sd_gamma_demo", 24 | "sd_innov_gamma", "sd_innov_delta", "sd_innov_logsd") 25 | 26 | var_types <- list(group_names = c("character", "factor"), 27 | geo_name = c("character", "factor"), 28 | time_name = c("integer", "numeric"), 29 | survey_name = c("character", "factor"), 30 | weight_name = "numeric", 31 | strata_names = c("character", "factor", "integer", "numeric"), 32 | proportion_name = "numeric", 33 | modifier_names = c("integer", "numeric"), 34 | t1_modifier_names = c("integer", "numeric"), 35 | item = c("character", "factor"), 36 | n_grp = c("integer", "numeric"), 37 | s_grp = c("integer", "numeric")) 38 | 39 | index_names <- list("delta_gamma" = "time_name", 40 | "delta_tbar" = "time_name", 41 | # "diff" = c("unnamed_index", "unnamed_index"), 42 | # "disc" = "unnamed_index", 43 | "gamma" = c("time_name", "hier_params"), 44 | "gamma_raw" = c("time_name", "hier_params"), 45 | # "kappa" = c("unnamed_index" = "unnamed_index"), 46 | # "mu_theta_bar" = c("unnamed_index", "unnamed_index"), 47 | # "mu_gamma" = c("unnamed_index", "unnamed_index"), 48 | "nu_geo" = c("time_name", NULL), 49 | # "nu_geo_prior" = "unnamed_index", 50 | # "sd_gamma" = NA, 51 | # "sd_innov_delta" = NA, 52 | # "sd_innov_gamma" = NA, 53 | # "sd_innov_logsd" = NA, 54 | "sd_item" = "item_names", 55 | "sd_theta" = "time_name", 56 | "sd_theta_bar" = "time_name", 57 | "sd_total" = "time_name", 58 | "theta_l2" = c("time_name", NULL), 59 | "theta_bar" = c("time_name", "group_names"), 60 | "theta_bar_raw" = c("time_name", "group_names"), 61 | "var_item" = "item_names", 62 | "var_theta" = "time_name", 63 | "var_theta_bar_l2" = c("time_name", NULL), 64 | "xi" = "time_name", 65 | "z" = c("time_name", NULL, "group_names"), 66 | "z_l2" = c("time_name", NULL, NULL)) 67 | -------------------------------------------------------------------------------- /R/dichotomize_item_responses.r: -------------------------------------------------------------------------------- 1 | dichotomize <- function(item_data, ctrl) { 2 | # Dichotomize item response variables 3 | # 4 | # For item response variables with K ordered levels, make K - 1 indicators for 5 | # whether a response is ranked higher than k. 6 | 7 | # Get e.g. names A,B,C, where B,C are item variables 8 | original_names <- data.table::copy(names(item_data)) 9 | # After coercion we might have variables A,B,D,E, where B,D,E are items 10 | item_data <- coerce_item_types(item_data, ctrl) 11 | # Keep in item_names those that remain after type coercion, say B 12 | ctrl@item_names <- intersect(ctrl@item_names, names(item_data)) 13 | # Add those created during type coercion: B,ABDE-ABC=DE 14 | ctrl@item_names <- c(ctrl@item_names, setdiff(names(item_data), 15 | original_names)) 16 | stopifnot(length(ctrl@item_names) > 0) 17 | stopifnot(identical(unique(ctrl@item_names), ctrl@item_names)) 18 | 19 | for (k in ctrl@item_names) { 20 | stopifnot(is.numeric(item_data[[k]])) 21 | gt_cols <- dichotomize_r(item_data[[k]]) 22 | cn <- paste0(k, sub("^X", "", names(gt_cols))) 23 | item_data[, c(cn) := gt_cols] 24 | data.table::setattr(item_data, "gt_items", c(attr(item_data, "gt_items"), 25 | cn)) 26 | } 27 | invisible(item_data) 28 | } 29 | 30 | dichotomize_r <- function(vec) { 31 | vec <- as.numeric(vec) 32 | uniques <- sort(unique(na.omit(vec))) 33 | ret <- data.table::data.table("X_gt1" = rep(NA, length(vec))) 34 | for (i in seq.int(0, max(0, length(uniques) - 2))) { 35 | ret[, paste0("X_gt", i + 1) := as.integer(vec > uniques[i + 1])] 36 | } 37 | ret[] 38 | } 39 | 40 | coerce_item_types <- function(item_data, ctrl) { 41 | # Coerce item response variables to numeric 42 | # 43 | # Check item variable types. If logical or ordered, coerce them to numeric 44 | # without loss of information. If character or factor variables with only 2 45 | # levels, do the same; otherwise, one-hot encode them with a warning. 46 | for (k in ctrl@item_names) { 47 | k_levels <- unique(na.omit(item_data[[k]])) 48 | if (length(k_levels) == 1) { 49 | # k doesn't vary (this should be caught earlier) 50 | stop("'", k, "' doesn't vary after restricting the data; it cannot ", 51 | "be used as an item variable.") 52 | } 53 | if (inherits(item_data[[k]], c("logical", "ordered"))) { 54 | # We can coerce k to numeric without losing information. If it has more 55 | # than 2 levels, dichotomize() will later dichotomize it. 56 | coerced <- as.numeric(item_data[[k]]) 57 | item_data[, (k) := coerced] 58 | } else if (inherits(item_data[[k]], c("character", "factor"))) { 59 | # The levels of k have ambiguous rank. One-hot encode them. 60 | if (length(k_levels) > 2) { 61 | # one-hot encoding could discard information 62 | warning("The ", length(k_levels), " values of ", 63 | class(item_data[[k]]), " variable '", k, "' will be encoded as ", 64 | length(k_levels) - 1, " indicators. If the values of '", k, 65 | "' have rank order, coerce it to numeric or ordered to retain this ", 66 | "information.") 67 | } 68 | # one-hot encode k as nlevels-1 indicators 69 | for (i in seq.int(length(k_levels) - 1)) { 70 | item_data[, paste0(k, "_", i) := as.numeric(get(k) == k_levels[i])] 71 | } 72 | item_data[, (k) := NULL] 73 | } 74 | } 75 | return(item_data) 76 | } 77 | 78 | -------------------------------------------------------------------------------- /R/methods-control.r: -------------------------------------------------------------------------------- 1 | `:=` <- data.table::`:=` 2 | `%chin%` <- data.table::`%chin%` 3 | 4 | # Constructor for Control 5 | init_control <- function(item_data = item_data, 6 | item_names = item_names, 7 | time_name = time_name, 8 | geo_name = geo_name, 9 | group_names = group_names, 10 | id_vars = id_vars, 11 | time_filter = time_filter, 12 | geo_filter = geo_filter, 13 | min_t_filter = min_t_filter, 14 | min_survey_filter = min_survey_filter, 15 | survey_name = survey_name, 16 | aggregate_data = aggregate_data, 17 | aggregate_item_names = aggregate_item_names, 18 | modifier_data = modifier_data, 19 | modifier_names = modifier_names, 20 | t1_modifier_names = t1_modifier_names, 21 | standardize = standardize, 22 | target_data = target_data, 23 | raking = raking, 24 | weight_name = weight_name, 25 | proportion_name = proportion_name, 26 | max_raked_weight = max_raked_weight, 27 | constant_item = constant_item, 28 | ...) { 29 | ctrl <- new("Control", 30 | item_names = item_names, 31 | time_name = time_name, 32 | geo_name = geo_name, 33 | group_names = group_names, 34 | id_vars = id_vars, 35 | # restrictions 36 | time_filter = time_filter, 37 | geo_filter = geo_filter, 38 | min_t_filter = min_t_filter, 39 | min_survey_filter = min_survey_filter, 40 | survey_name = survey_name, 41 | # aggregate data 42 | aggregate_item_names = aggregate_item_names, 43 | # modifier data 44 | modifier_names = modifier_names, 45 | t1_modifier_names = t1_modifier_names, 46 | standardize = standardize, 47 | # target data 48 | raking = raking, 49 | weight_name = weight_name, 50 | proportion_name = proportion_name, 51 | max_raked_weight = max_raked_weight, 52 | # modeling options 53 | constant_item = constant_item, 54 | ...) 55 | 56 | if (length(item_data)) { 57 | is_item_name <- valid_names(item_data, ctrl, 1L) 58 | is_item_name(c("time_name", "geo_name")) 59 | has_type(c("time_name", "geo_name"), item_data, ctrl) 60 | } 61 | 62 | if (length(aggregate_data)) { 63 | is_agg_name <- valid_names(aggregate_data, ctrl, 1L) 64 | is_agg_name(c("time_name", "geo_name")) 65 | has_type(c("time_name", "geo_name"), aggregate_data, ctrl) 66 | if (!length(aggregate_item_names)) { 67 | is_agg_name <- valid_names(aggregate_data, NULL, 1L) 68 | is_agg_name("item") 69 | ctrl@aggregate_item_names = sort(unique(aggregate_data[["item"]])) 70 | } 71 | } 72 | 73 | if (!length(item_data) & !length(aggregate_data)) { 74 | stop("either \"item_data\" or \"aggregate_data\" must be specified") 75 | } 76 | 77 | if (length(ctrl@modifier_names)) { 78 | if (!length(ctrl@t1_modifier_names)) { 79 | ctrl@t1_modifier_names <- ctrl@modifier_names 80 | } 81 | } 82 | 83 | if (!length(ctrl@time_filter)) { 84 | if (length(item_data)) { 85 | ctrl@time_filter <- sort(unique(item_data[[ctrl@time_name]])) 86 | } 87 | if (length(aggregate_data)) { 88 | ctrl@time_filter <- sort(unique(c(ctrl@time_filter, 89 | aggregate_data[[ctrl@time_name]]))) 90 | } 91 | } 92 | 93 | if (!length(ctrl@geo_filter)) { 94 | if (length(item_data)) { 95 | ctrl@geo_filter <- sort(unique(as.character(item_data[[ctrl@geo_name]]))) 96 | } 97 | if (length(aggregate_data)) { 98 | ctrl@geo_filter <- sort(unique(c(ctrl@geo_filter, 99 | aggregate_data[[ctrl@geo_name]]))) 100 | } 101 | } 102 | 103 | if (length(raking)) { 104 | if (is.list(ctrl@raking)) { 105 | ctrl@rake_names = unlist(lapply(ctrl@raking, all.vars)) 106 | } else { 107 | ctrl@rake_names = all.vars(ctrl@raking) 108 | } 109 | } 110 | 111 | ctrl@has_individual_data = ifelse(length(item_data), TRUE, FALSE) 112 | ctrl@has_aggregate_data = ifelse(length(aggregate_data), TRUE, FALSE) 113 | ctrl@has_modifier_data = ifelse(length(modifier_data), TRUE, FALSE) 114 | ctrl@has_target_data = ifelse(length(target_data), TRUE, FALSE) 115 | 116 | ctrl 117 | } 118 | -------------------------------------------------------------------------------- /R/name_helpers.r: -------------------------------------------------------------------------------- 1 | utils::globalVariables(c("fname", "group_names", "i_end", "i_start", "j", 2 | "j_end", "j_start", "param")) 3 | 4 | flatnames <- function(dgirt_out, fnames = NULL) { 5 | 6 | control <- dgirt_out@dgirt_in$control 7 | if (!length(fnames)) { 8 | fnames <- dgirt_out@sim$fnames_oi 9 | } 10 | 11 | fname_len <- length(fnames) 12 | ftab <- data.table::setDT(list(fname = fnames)) 13 | ftab[, param := sub("(^.*)\\[.*", "\\1", fname)] 14 | i_match = regexpr("(?<=\\[)\\d+(?=\\]|,)", fnames, perl = TRUE) 15 | j_match = regexpr("(?<=,|\\[)\\d+(?=\\])", fnames, perl = TRUE) 16 | match_end <- function(x) x + attr(x, "match.length") - 1L 17 | ftab[, `:=`(i_start = i_match, 18 | i_end = match_end(i_match), 19 | j_start = j_match, 20 | j_end = match_end(j_match))] 21 | ftab[i_start > 0, i := type.convert(substr(fname, i_start, i_end))] 22 | ftab[j_start > 0, j := type.convert(substr(fname, j_start, j_end))] 23 | ftab[, grep("_start|_end", names(ftab)) := NULL] 24 | 25 | for (parname in unique(ftab[["param"]])) { 26 | # index_names is a list for looking up the names of parameter indexes 27 | for (i in index_names[[parname]]) { 28 | if (length(i)) { 29 | pos <- c("i", "j")[which(index_names[[parname]] == i)] 30 | ftab[param == parname, c(i) := get(pos)] 31 | } 32 | } 33 | } 34 | 35 | if ("group_names" %in% names(ftab)) { 36 | group_grid <- data.table::setDT(dgirt_out@dgirt_in$group_grid_t) 37 | group_grid[, group_names := .I] 38 | ftab <- merge(ftab, group_grid, by = "group_names", all.x = TRUE) 39 | } 40 | 41 | if ("time_name" %in% names(ftab)) { 42 | time_grid <- data.table::setDT(setNames(list(seq_along(control@time_filter), 43 | control@time_filter), 44 | c("time_name", control@time_name))) 45 | ftab <- merge(ftab, time_grid, by = "time_name", all.x = TRUE) 46 | } 47 | 48 | if ("hier_params" %in% names(ftab)) { 49 | hier_grid <- data.table::setDT(list(hier_params = seq_along(dgirt_out@dgirt_in$hier_names), 50 | hier_param = dgirt_out@dgirt_in$hier_names)) 51 | ftab <- merge(ftab, hier_grid, by = "hier_params", all.x = TRUE) 52 | } 53 | 54 | if ("item_names" %in% names(ftab)) { 55 | item_grid <- data.table::setDT(list(item_names = seq_along(dgirt_out@dgirt_in$gt_items), 56 | item = dgirt_out@dgirt_in$gt_items)) 57 | ftab <- merge(ftab, item_grid, by = "item_names", all.x = TRUE) 58 | } 59 | 60 | drop_cols <- intersect(names(ftab), c("item_names", "hier_params", 61 | "time_name", "group_names", "i", "j")) 62 | if (length(drop_cols)) { 63 | ftab[, c(drop_cols) := NULL] 64 | } 65 | 66 | stopifnot(identical(nrow(ftab), fname_len)) 67 | ftab 68 | } 69 | -------------------------------------------------------------------------------- /R/package.R: -------------------------------------------------------------------------------- 1 | #' dgo: Dynamic Estimation of Group-level Opinion 2 | #' 3 | #' Fit dynamic group-level IRT and MRP models from individual or aggregated item 4 | #' response data. This package handles common preprocessing tasks and extends 5 | #' functions for inspecting results, poststratification, and quick iteration 6 | #' over alternative models. 7 | #' 8 | #' @docType package 9 | #' @name dgo 10 | #' @import data.table 11 | #' @import dgodata 12 | #' @import ggplot2 13 | #' @import methods 14 | #' @importFrom lubridate seconds_to_period 15 | #' @importFrom stats as.formula formula model.frame model.matrix na.fail na.omit 16 | #' quantile sd setNames weighted.mean weights 17 | #' @importFrom utils capture.output type.convert packageVersion 18 | NULL 19 | -------------------------------------------------------------------------------- /R/rake_partial.r: -------------------------------------------------------------------------------- 1 | # This is a minor modification of survey::rake that ignores (leaves unweighted) empty cells 2 | # nolint start 3 | rake_partial <- function(design, sample.margins, population.margins, control = list(maxit = 10, 4 | epsilon = 1, verbose = FALSE), compress = NULL) { 5 | if (!missing(control)) { 6 | control.defaults <- formals(survey::rake)$control 7 | for (n in names(control.defaults)) if (!(n %in% names(control))) 8 | control[[n]] <- control.defaults[[n]] 9 | } 10 | is.rep <- inherits(design, "svyrep.design") 11 | if (is.rep && is.null(compress)) 12 | compress <- inherits(design$repweights, "repweights_compressed") 13 | if (is.rep) 14 | design$degf <- NULL 15 | nmar <- length(sample.margins) 16 | if (control$epsilon < 1) 17 | epsilon <- control$epsilon * sum(weights(design, "sampling")) 18 | else epsilon <- control$epsilon 19 | strata <- lapply(sample.margins, function(margin) if (inherits(margin, 20 | "formula")) { 21 | mf <- model.frame(margin, data = design$variables, na.action = na.fail) 22 | }) 23 | allterms <- unlist(lapply(sample.margins, all.vars)) 24 | ff <- formula(paste("~", paste(allterms, collapse = "+"), 25 | sep = "")) 26 | oldtable <- survey::svytable(ff, design) 27 | if (control$verbose) 28 | print(oldtable) 29 | oldpoststrata <- design$postStrata 30 | iter <- 0 31 | converged <- FALSE 32 | while (iter < control$maxit) { 33 | design$postStrata <- NULL 34 | for (i in 1:nmar) { 35 | # The only change is to add ", partial = TRUE" below 36 | design <- survey::postStratify(design, strata[[i]], population.margins[[i]], 37 | compress = FALSE, partial = TRUE) 38 | } 39 | newtable <- survey::svytable(ff, design) 40 | if (control$verbose) 41 | print(newtable) 42 | delta <- max(abs(oldtable - newtable)) 43 | if (delta < epsilon) { 44 | converged <- TRUE 45 | break 46 | } 47 | oldtable <- newtable 48 | iter <- iter + 1 49 | } 50 | rakestrata <- design$postStrata 51 | if (!is.null(rakestrata)) { 52 | class(rakestrata) <- "raking" 53 | design$postStrata <- c(oldpoststrata, list(rakestrata)) 54 | } 55 | design$call <- sys.call() 56 | if (is.rep && compress) 57 | design$repweights <- survey::compressWeights(design$repweights) 58 | if (is.rep) 59 | design$degf <- survey::degf(design) 60 | if (!converged) 61 | warning("Raking did not converge after ", iter, " iterations.\n") 62 | return(design) 63 | } 64 | # nolint end 65 | -------------------------------------------------------------------------------- /R/reweight_item_responses.r: -------------------------------------------------------------------------------- 1 | utils::globalVariables(c("raked_weight", "preweight")) 2 | 3 | weight <- function(item_data, target_data, control) { 4 | # Adjust individual survey weights given population targets 5 | 6 | item_data[, c("preweight") := rake_weights(item_data, target_data, control)] 7 | 8 | if (length(control@max_raked_weight)) { 9 | item_data[preweight > control@max_raked_weight, preweight := 10 | control@max_raked_weight] 11 | } 12 | 13 | item_data[, c("raked_weight") := list(get("preweight") / 14 | mean(get("preweight"), na.rm = TRUE)), 15 | by = eval(control@time_name)] 16 | 17 | message("\nOriginal weights:") 18 | message(paste0(capture.output(summary(item_data[[control@weight_name]])), 19 | collapse = "\n")) 20 | message("\nRaked weights:") 21 | message(paste0(capture.output(summary(item_data[, raked_weight])), 22 | collapse = "\n")) 23 | item_data 24 | } 25 | 26 | rake_weights <- function(item_data, target_data, control) { 27 | if (!is.list(control@raking)) { 28 | formulas <- list(control@raking) 29 | } else { 30 | formulas <- control@raking 31 | } 32 | item_design <- survey::svydesign(ids = ~1, data = item_data, 33 | weights = formula(paste0("~", control@weight_name))) 34 | target_design <- survey::svydesign(ids = ~1, data = target_data, 35 | weights = formula(paste0("~", control@proportion_name))) 36 | target_tables <- lapply(formulas, survey::svytable, 37 | design = target_design) 38 | raked_design <- rake_partial(design = item_design, 39 | sample.margins = formulas, 40 | population.margins = target_tables, 41 | control = list(epsilon = 1e-09)) 42 | raked_weights <- 1 / raked_design$prob 43 | assertthat::assert_that(is.numeric(raked_weights)) 44 | if (any(is.na(raked_weights))) { 45 | warning("NA values in raked weights") 46 | } 47 | if (any(raked_weights < 0)) { 48 | warning("Negative values in raked weights") 49 | } 50 | return(raked_weights) 51 | } 52 | 53 | -------------------------------------------------------------------------------- /R/shape_hierarchical.r: -------------------------------------------------------------------------------- 1 | shape_hierarchical_data <- function(modifier_data, modifier_names, group_grid_t, 2 | XX, ctrl) { 3 | # The array of hierarchical data ZZ should be T x P x H, where T is the 4 | # number of time periods, P is the number of hierarchical parameters 5 | # (including the geographic), and H is the number of predictors for 6 | # geographic unit effects. 7 | if (!length(modifier_names)) { 8 | return(zero_zz(XX, ctrl)) 9 | } 10 | hierarchical <- data.table::copy(modifier_data) 11 | hierarchical <- drop_extra_cols(hierarchical, modifier_names, ctrl) 12 | data.table::setkeyv(hierarchical, c(ctrl@geo_name, ctrl@time_name)) 13 | if (length(ctrl@group_names)) { 14 | unmodeled <- zero_unmodeled(hierarchical, modifier_names, group_grid_t, ctrl) 15 | hierarchical <- rbind(hierarchical, unmodeled) 16 | } 17 | zz <- create_zz(hierarchical, modifier_names, ctrl) 18 | return(zz) 19 | } 20 | 21 | zero_zz <- function(XX, ctrl) { 22 | zz_dimnames <- list(ctrl@time_filter, dimnames(XX)[[2]], "") 23 | zz <- array(data = 0, dim = lapply(zz_dimnames, length), dimnames = 24 | zz_dimnames) 25 | zz 26 | } 27 | 28 | drop_extra_cols <- function(hierarchical, modifier_names, ctrl) { 29 | extra_colnames <- setdiff(names(hierarchical), c(ctrl@geo_name, 30 | ctrl@time_name, modifier_names)) 31 | if (length(extra_colnames)) { 32 | hierarchical[, c(extra_colnames) := NULL] 33 | } 34 | hierarchical 35 | } 36 | 37 | zero_unmodeled <- function(hierarchical, modifier_names, group_grid_t, ctrl) { 38 | # make a zeroed table for unmodeled parameters by time period 39 | modeled_param_names <- unique(hierarchical[[ctrl@geo_name]]) 40 | # unmodeled param levels will be those of groups 41 | unmodeled_param_levels = unlist(lapply(ctrl@group_names, function(x) { 42 | paste0(x, unique(group_grid_t[[x]]))[-1] 43 | })) 44 | unmodeled_frame <- expand.grid(c(list(unmodeled_param_levels, 45 | ctrl@time_filter), rep(list(0L), length(modifier_names)))) 46 | unmodeled_frame <- setNames(unmodeled_frame, c(ctrl@geo_name, ctrl@time_name, 47 | modifier_names)) 48 | data.table::setDT(unmodeled_frame, key = c(ctrl@geo_name, ctrl@time_name)) 49 | unmodeled_frame 50 | } 51 | 52 | create_zz <- function(hierarchical, modifier_names, ctrl) { 53 | unique_time <- unique(hierarchical[[ctrl@time_name]]) 54 | unique_geo <- unique(hierarchical[[ctrl@geo_name]]) 55 | zz <- sapply(modifier_names, function(x) { 56 | matrix(hierarchical[[x]], 57 | # We have T rows, so filling by column is correct SO LONG AS time varies 58 | # fastest then geo in hierarchical 59 | nrow = length(unique_time), ncol = length(unique_geo), 60 | dimnames = list(unique_time, unique_geo)) 61 | }, simplify = 'array') 62 | # omit first geo parameter 63 | zz <- zz[, -1, , drop = FALSE] 64 | zz 65 | } 66 | 67 | -------------------------------------------------------------------------------- /R/toy_dgirt_in.r: -------------------------------------------------------------------------------- 1 | #' A minimal example of shaped data 2 | #' 3 | #' \code{\link[dgo]{shape}} returns a \code{\link[dgo]{dgirtin-class}} object 4 | #' used with \code{\link[dgo]{dgirt}} for DGIRT modeling. \code{toy_dgirt_in} is 5 | #' a minimal \code{\link[dgo]{dgirtin-class}} object for use in examples. 6 | #' 7 | #' @docType data 8 | #' @name toy_dgirt_in 9 | #' @usage toy_dgirt_in 10 | #' @format A \code{\link[dgo]{dgirtin-class}} object. 11 | NULL 12 | -------------------------------------------------------------------------------- /R/toy_dgirtfit.r: -------------------------------------------------------------------------------- 1 | #' A minimal example of a fitted model 2 | #' 3 | #' \code{\link[dgo]{dgirt}} returns a \code{\link[dgo]{dgirtfit}}-class object 4 | #' that extends \code{\link[rstan]{stanfit-class}}. \code{toy_dgirtfit} is a 5 | #' minimal \code{\link[dgo]{dgirtfit}} object for use in examples. 6 | #' 7 | #' @docType data 8 | #' @name toy_dgirtfit 9 | #' @usage toy_dgirtfit 10 | #' @format A \code{\link[dgo]{dgirtfit-class}} object. 11 | NULL 12 | -------------------------------------------------------------------------------- /R/validate_dgirtIn.r: -------------------------------------------------------------------------------- 1 | check_names <- function(d_in) { 2 | if (!all.equal(dimnames(d_in$ZZ)[[2]], colnames(d_in$XX)) && 3 | all.equal(dimnames(d_in$ZZ_prior)[[2]], colnames(d_in$XX))) 4 | stop("Names in the design matrix and array of hierarchical data are ", 5 | "expected to match but don't.") 6 | 7 | n_vec_groups <- data.table::copy(d_in$group_counts) 8 | n_vec_groups[, `:=`(group = do.call(paste, c(.SD, sep = "__"))), 9 | .SDcols = c(d_in$control@geo_name, 10 | d_in$control@group_names)] 11 | if (!all(n_vec_groups[["group"]] %in% rownames(d_in$XX))) { 12 | stop("Not all cell names appear in the rownames of the design matrix, ", 13 | "which shouldn't be possible.") 14 | } 15 | 16 | observed_geo = unique(d_in$group_counts[[d_in$control@geo_name]]) 17 | if (sum(!observed_geo %in% dimnames(d_in$ZZ)[[2]]) > 1) { 18 | stop("Not all geographic areas appear as ZZ columns; this is a bug.") 19 | } 20 | if (sum(!observed_geo %in% dimnames(d_in$XX)[[2]]) > 1) { 21 | stop("Not all geographic areas appear as XX columns; this is a bug.") 22 | } 23 | observed_t = unique(d_in$group_counts[[d_in$control@time_name]]) 24 | if (!all(observed_t %in% dimnames(d_in$ZZ)[[1]])) { 25 | stop("Not all time periods appear as ZZ columns; this is a bug.") 26 | } 27 | } 28 | 29 | check_values <- function(d_in) { 30 | 31 | # XX is an indicator matrix 32 | XX_values = sort(unique(as.vector(d_in$XX))) 33 | assertthat::assert_that(assertthat::are_equal(XX_values, c(0L, 1L))) 34 | 35 | assertthat::assert_that(all(d_in$WT >= 0)) 36 | 37 | # n_vec is a count 38 | assertthat::assert_that(all(d_in$n_vec %% 1 == 0)) 39 | assertthat::assert_that(all(d_in$n_vec >= 0)) 40 | 41 | # s_vec is a count 42 | assertthat::assert_that(all(d_in$s_vec %% 1 == 0)) 43 | assertthat::assert_that(all(d_in$s_vec >= 0)) 44 | 45 | # observed gives indexes of positive n_vec 46 | assertthat::assert_that(all(d_in$observed %% 1 == 0)) 47 | assertthat::assert_that(all(d_in$observed >= 0)) 48 | 49 | # there can be no more successes than trials 50 | assertthat::assert_that(all(as.vector(d_in$s_vec) <= as.vector(d_in$n_vec))) 51 | 52 | # each of these elements gives a parameter count 53 | counts = c("T", "G", "G_hier", "Q", "D", "N", "P", "S", "H", "Hprior", 54 | "N_observed") 55 | for (x in counts) { 56 | assertthat::assert_that(assertthat::is.count(d_in[[x]])) 57 | } 58 | 59 | # S is the count of geographic predictors, which must be positive but can be 60 | # no larger than the count of geographic and demographic predictors 61 | assertthat::assert_that(d_in$S <= d_in$P) 62 | assertthat::assert_that(d_in$S > 0) 63 | 64 | } 65 | 66 | check_dimensions <- function(d_in) { 67 | stopifnot(identical(length(d_in$hier_names), dim(d_in$ZZ)[[2]])) 68 | assertthat::assert_that(equal_length(d_in$n_vec, d_in$s_vec)) 69 | assertthat::assert_that(all_equal(dim(d_in$NNl2), as.integer(c(d_in$T, d_in$Q, d_in$G_hier)))) 70 | assertthat::assert_that(all_equal(dim(d_in$SSl2), as.integer(c(d_in$T, d_in$Q, d_in$G_hier)))) 71 | assertthat::assert_that(all_equal(dim(d_in$WT), as.integer(c(d_in$T, d_in$G_hier, d_in$G)))) 72 | assertthat::assert_that(all_equal(dim(d_in$l2_only), c(d_in$T, d_in$Q))) 73 | # hier_params = d_in$P - 1 + ifelse(d_in$P != d_in$S, d_in$P - d_in$S, 1) 74 | assertthat::assert_that(all_equal(dim(d_in$XX), c(d_in$G, dim(d_in$ZZ)[2]))) 75 | assertthat::assert_that(all_equal(dim(d_in$ZZ), c(d_in$T, d_in$P, d_in$H))) 76 | assertthat::assert_that(all_equal(dim(d_in$ZZ_prior), c(d_in$T, d_in$P, d_in$Hprior))) 77 | assertthat::assert_that(not_empty((d_in$constant_item))) 78 | stopifnot(all.equal(d_in$N, d_in$G * d_in$T * d_in$Q)) 79 | } 80 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'dgo: Dynamic Estimation of Group-Level Opinion' 3 | output: github_document 4 | --- 5 | [![Build Status](https://travis-ci.org/jamesdunham/dgo.svg?branch=master)](https://travis-ci.org/jamesdunham/dgo) 6 | [![Build status](https://ci.appveyor.com/api/projects/status/1ta36kmoqen98k87?svg=true)](https://ci.appveyor.com/project/jamesdunham/dgo) 7 | [![codecov](https://codecov.io/gh/jamesdunham/dgo/branch/master/graph/badge.svg)](https://codecov.io/gh/jamesdunham/dgo) 8 | 9 | # Introduction 10 | 11 | dgo is an R package for the dynamic estimation of group-level public opinion. 12 | You can use the package to estimate latent trait means in subpopulations from 13 | survey data. For example, dgo can estimate the average policy liberalism in each 14 | American state over time among Democrats, Independents, and Republicans, given 15 | their answers to survey questions about policy proposals. 16 | 17 | dgo accomplishes this using a Bayesian group-level IRT approach developed by 18 | [Caughey and Warshaw 19 | 2015](http://pan.oxfordjournals.org/content/early/2015/02/04/pan.mpu021.full.pdf+html). 20 | It models latent traits at the level of demographic and geographic groups rather 21 | than individuals. It uses a hierarchical model to borrow strength 22 | cross-sectionally and dynamic linear models to do so across time. 23 | 24 | The package can also be used to estimate smoothed estimates of subpopulations' 25 | average responses to single survey items, using a dynamic multi-level regression 26 | and poststratification (MRP) model ([Park, Gelman, and Bafumi 27 | 2004](http://stat.columbia.edu/~gelman/research/published/StateOpinionsNationalPolls.050712.dkp.pdf)). 28 | For instance, you can use dgo to estimate public opinion in each state on 29 | same-sex marriage or the Affordable Care Act. 30 | 31 | This model opens up new areas of research on historical public opinion in the 32 | United States at the subnational level. It also allows scholars of comparative 33 | politics to estimate dynamic cross-national models of public opinion. 34 | 35 | ```{r, knitr-options, echo = FALSE} 36 | # rmarkdown::render("README.Rmd") 37 | knitr::opts_chunk$set( 38 | echo = TRUE, 39 | collapse = TRUE, 40 | comment = "#>", 41 | cache = TRUE, 42 | cache.path = 'readme-cache/', 43 | fig.path = "README/") 44 | ``` 45 | 46 | # Installation 47 | 48 | dgo can be installed from [CRAN](https://CRAN.R-project.org/package=dgo): 49 | 50 | ```{r, eval = FALSE} 51 | install.packages("dgo") 52 | ``` 53 | 54 | Or get the latest version from [GitHub](https://github.com/jamesdunham/dgo) 55 | using [devtools](https://github.com/hadley/devtools/): 56 | 57 | ```{r, eval = FALSE} 58 | if (!require(devtools, quietly = TRUE)) install.packages("devtools") 59 | devtools::install_github("jamesdunham/dgo") 60 | ``` 61 | 62 | dgo requires a working installation of [RStan](http://mc-stan.org/interfaces/rstan.html). 63 | If you don't have already have RStan, follow its 64 | "[Getting Started](https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started)" guide. 65 | 66 | # Usage 67 | 68 | Load the package and set RStan's recommended options for a local, multicore 69 | machine with excess RAM: 70 | 71 | ```{r, result = 'hide', message = FALSE} 72 | library(dgo) 73 | rstan_options(auto_write = TRUE) 74 | options(mc.cores = parallel::detectCores()) 75 | ``` 76 | 77 | The minimal workflow from raw data to estimation is: 78 | 79 | 1. shape input data using the `shape()` function; and 80 | 2. pass the result to the `dgirt()` function to estimate a latent trait (e.g., 81 | conservatism) or `dgmrp()` function to estimate opinion on a single survey 82 | question. 83 | 84 | # Troubleshooting 85 | 86 | Please [report issues](https://github.com/jamesdunham/dgo/issues) that you 87 | encounter. 88 | 89 | * OS X only: RStan creates temporary files during estimation in a location 90 | given by `tempdir()`, typically an arbitrary location in `/var/folders`. If 91 | a model runs for days, these files can be cleaned up while still needed, 92 | which induces an error. A good solution is to set a safer path for temporary 93 | files, using an environment variable checked at session startup. For help 94 | setting environment variables, see the Stack Overflow question 95 | [here](https://stackoverflow.com/questions/17107206/change-temporary-directory). 96 | Confirm the new path before starting your model run by restarting R and 97 | checking the output from `tempdir()`. 98 | 99 | * Models fitted before October 2016 (specifically < 100 | [#8e6a2cf](https://github.com/jamesdunham/dgo/commit/8e6a2cfbe00b2cd4a908b3067241e06124d143cd)) 101 | using dgirt are not fully compatible with dgo. Their contents can be 102 | extracted without using dgo, however, with the `$` indexing operator. For 103 | example: `as.data.frame(dgirtfit_object$stan.cmb)`. 104 | 105 | * Calling `dgirt()` or `dgmrp()` can generate 106 | [warnings](http://mc-stan.org/misc/warnings#compiler-warnings) during model 107 | compilation. These are safe to ignore, or can be suppressed by following the 108 | linked instructions. 109 | 110 | # Contributing and citing 111 | 112 | dgo is under development and we welcome 113 | [suggestions](https://github.com/jamesdunham/dgo/issues). 114 | 115 | The package citation is: 116 | 117 | Dunham, James, Devin Caughey, and Christopher Warshaw. 2018. dgo: Dynamic 118 | Estimation of Group-level Opinion. R package. https://jdunham.io/dgo/. 119 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | dgo: Dynamic Estimation of Group-Level Opinion 2 | ================ 3 | 4 | [![Build 5 | Status](https://travis-ci.org/jamesdunham/dgo.svg?branch=master)](https://travis-ci.org/jamesdunham/dgo) 6 | [![Build 7 | status](https://ci.appveyor.com/api/projects/status/1ta36kmoqen98k87?svg=true)](https://ci.appveyor.com/project/jamesdunham/dgo) 8 | [![codecov](https://codecov.io/gh/jamesdunham/dgo/branch/master/graph/badge.svg)](https://codecov.io/gh/jamesdunham/dgo) 9 | 10 | # Introduction 11 | 12 | dgo is an R package for the dynamic estimation of group-level public 13 | opinion. You can use the package to estimate latent trait means in 14 | subpopulations from survey data. For example, dgo can estimate the 15 | average policy liberalism in each American state over time among 16 | Democrats, Independents, and Republicans, given their answers to survey 17 | questions about policy proposals. 18 | 19 | dgo accomplishes this using a Bayesian group-level IRT approach 20 | developed by [Caughey and Warshaw 21 | 2015](http://pan.oxfordjournals.org/content/early/2015/02/04/pan.mpu021.full.pdf+html). 22 | It models latent traits at the level of demographic and geographic 23 | groups rather than individuals. It uses a hierarchical model to borrow 24 | strength cross-sectionally and dynamic linear models to do so across 25 | time. 26 | 27 | The package can also be used to estimate smoothed estimates of 28 | subpopulations’ average responses to single survey items, using a 29 | dynamic multi-level regression and poststratification (MRP) model 30 | ([Park, Gelman, and Bafumi 31 | 2004](http://stat.columbia.edu/~gelman/research/published/StateOpinionsNationalPolls.050712.dkp.pdf)). 32 | For instance, you can use dgo to estimate public opinion in each state 33 | on same-sex marriage or the Affordable Care Act. 34 | 35 | This model opens up new areas of research on historical public opinion 36 | in the United States at the subnational level. It also allows scholars 37 | of comparative politics to estimate dynamic cross-national models of 38 | public opinion. 39 | 40 | # Installation 41 | 42 | dgo can be installed from 43 | [CRAN](https://CRAN.R-project.org/package=dgo): 44 | 45 | ``` r 46 | install.packages("dgo") 47 | ``` 48 | 49 | Or get the latest version from 50 | [GitHub](https://github.com/jamesdunham/dgo) using 51 | [devtools](https://github.com/hadley/devtools/): 52 | 53 | ``` r 54 | if (!require(devtools, quietly = TRUE)) install.packages("devtools") 55 | devtools::install_github("jamesdunham/dgo") 56 | ``` 57 | 58 | dgo requires a working installation of 59 | [RStan](http://mc-stan.org/interfaces/rstan.html). If you don’t have 60 | already have RStan, follow its “[Getting 61 | Started](https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started)” 62 | guide. 63 | 64 | # Usage 65 | 66 | Load the package and set RStan’s recommended options for a local, 67 | multicore machine with excess RAM: 68 | 69 | ``` r 70 | library(dgo) 71 | rstan_options(auto_write = TRUE) 72 | options(mc.cores = parallel::detectCores()) 73 | ``` 74 | 75 | The minimal workflow from raw data to estimation is: 76 | 77 | 1. shape input data using the `shape()` function; and 78 | 2. pass the result to the `dgirt()` function to estimate a latent trait 79 | (e.g., conservatism) or `dgmrp()` function to estimate opinion on a 80 | single survey question. 81 | 82 | # Troubleshooting 83 | 84 | Please [report issues](https://github.com/jamesdunham/dgo/issues) that 85 | you encounter. 86 | 87 | - OS X only: RStan creates temporary files during estimation in a 88 | location given by `tempdir()`, typically an arbitrary location in 89 | `/var/folders`. If a model runs for days, these files can be cleaned 90 | up while still needed, which induces an error. A good solution is to 91 | set a safer path for temporary files, using an environment variable 92 | checked at session startup. For help setting environment variables, 93 | see the Stack Overflow question 94 | [here](https://stackoverflow.com/questions/17107206/change-temporary-directory). 95 | Confirm the new path before starting your model run by restarting R 96 | and checking the output from `tempdir()`. 97 | 98 | - Models fitted before October 2016 (specifically \< 99 | [\#8e6a2cf](https://github.com/jamesdunham/dgo/commit/8e6a2cfbe00b2cd4a908b3067241e06124d143cd)) 100 | using dgirt are not fully compatible with dgo. Their contents can be 101 | extracted without using dgo, however, with the `$` indexing 102 | operator. For example: `as.data.frame(dgirtfit_object$stan.cmb)`. 103 | 104 | - Calling `dgirt()` or `dgmrp()` can generate 105 | [warnings](http://mc-stan.org/misc/warnings#compiler-warnings) 106 | during model compilation. These are safe to ignore, or can be 107 | suppressed by following the linked instructions. 108 | 109 | # Contributing and citing 110 | 111 | dgo is under development and we welcome 112 | [suggestions](https://github.com/jamesdunham/dgo/issues). 113 | 114 | The package citation is: 115 | 116 | Dunham, James, Devin Caughey, and Christopher Warshaw. 2018. dgo: 117 | Dynamic Estimation of Group-level Opinion. R package. 118 | . 119 | -------------------------------------------------------------------------------- /README/dgirt_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/README/dgirt_plot-1.png -------------------------------------------------------------------------------- /README/dgirt_plot_ps-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/README/dgirt_plot_ps-1.png -------------------------------------------------------------------------------- /README/dgmrp_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/README/dgmrp_plot-1.png -------------------------------------------------------------------------------- /README/dgmrp_plot_plus-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/README/dgmrp_plot_plus-1.png -------------------------------------------------------------------------------- /README/dgmrp_plot_ps-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/README/dgmrp_plot_ps-1.png -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | authors: 2 | James Dunham: 3 | href: https://jdunham.io 4 | Devin Caughey: 5 | href: http://caughey.mit.edu/welcome 6 | Christopher Warshaw: 7 | href: http://cwarshaw.scripts.mit.edu/ 8 | 9 | template: 10 | params: 11 | bootswatch: readable 12 | 13 | reference: 14 | - title: Shaping input data 15 | contents: 16 | - shape 17 | - toy_dgirt_in 18 | - dgirtin-class 19 | - title: Estimation 20 | contents: 21 | - dgirt 22 | - dgmrp 23 | - toy_dgirtfit 24 | - dgirt_fit-class 25 | - dgmrp_fit-class 26 | - dgo_fit-class 27 | - title: Postestimation 28 | contents: 29 | - poststratify 30 | - plot_rhats 31 | - dgirt_plot 32 | 33 | navbar: 34 | left: 35 | - text: Policy Liberalism 36 | href: articles/policy_liberalism.html 37 | - text: Abortion Attitudes 38 | href: articles/abortion_attitudes.html 39 | - text: Reference 40 | href: reference/index.html 41 | - text: News 42 | href: news/index.html 43 | - icon: fa-github fa-lg 44 | href: https://github.com/jamesdunham/dgo 45 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # From https://github.com/tidyverse/readr/blob/master/appveyor.yml 2 | # DO NOT CHANGE the "init" and "install" sections below 3 | 4 | # Download script file from GitHub 5 | init: 6 | ps: | 7 | $ErrorActionPreference = "Stop" 8 | Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1" 9 | Import-Module '..\appveyor-tool.ps1' 10 | 11 | install: 12 | ps: Bootstrap 13 | 14 | # Adapt as necessary starting from here 15 | 16 | environment: 17 | global: 18 | WARNINGS_ARE_ERRORS: 1 19 | USE_RTOOLS: true 20 | 21 | matrix: 22 | - R_VERSION: release 23 | R_ARCH: x64 24 | 25 | - R_VERSION: release 26 | R_ARCH: i386 27 | 28 | build_script: 29 | - travis-tool.sh install_deps 30 | 31 | test_script: 32 | - travis-tool.sh run_tests 33 | 34 | on_failure: 35 | - 7z a failure.zip *.Rcheck\* 36 | - appveyor PushArtifact failure.zip 37 | 38 | artifacts: 39 | - path: '*.Rcheck\**\*.log' 40 | name: Logs 41 | 42 | - path: '*.Rcheck\**\*.out' 43 | name: Logs 44 | 45 | - path: '*.Rcheck\**\*.fail' 46 | name: Logs 47 | 48 | - path: '*.Rcheck\**\*.Rout' 49 | name: Logs 50 | 51 | - path: '\*_*.tar.gz' 52 | name: Bits 53 | 54 | - path: '\*_*.zip' 55 | name: Bits 56 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: 2 | layout: header, changes, diff 3 | coverage: 4 | status: 5 | patch: false 6 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Test environments 2 | 3 | * Ubuntu 14.04.5 LTS (on travis-ci), R 3.5.0 (release, devel) and R 3.4.4 4 | * macOS 10.12.6 and 10.11.6 (on travis-ci), R 3.5.0 and R 3.4.4 5 | * Windows Server 2012 R2 x64 (on appveyor), R 3.5.0 i386 and x64 6 | 7 | ## R CMD check results 8 | 9 | There were no ERRORs or NOTEs. appyeyor shows a WARNING that package 10 | dependencies were built under R 3.5.1. 11 | -------------------------------------------------------------------------------- /data/toy_dgirt_in.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/data/toy_dgirt_in.rda -------------------------------------------------------------------------------- /data/toy_dgirtfit.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/data/toy_dgirtfit.rda -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/__packages: -------------------------------------------------------------------------------- 1 | base 2 | dgodata 3 | ggplot2 4 | StanHeaders 5 | rstan 6 | dgo 7 | -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/dgmrp_plot_4d97bccd4b58595c19fcc9945abb4081.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/dgmrp_plot_4d97bccd4b58595c19fcc9945abb4081.RData -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/dgmrp_plot_4d97bccd4b58595c19fcc9945abb4081.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/dgmrp_plot_4d97bccd4b58595c19fcc9945abb4081.rdb -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/dgmrp_plot_4d97bccd4b58595c19fcc9945abb4081.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/dgmrp_plot_4d97bccd4b58595c19fcc9945abb4081.rdx -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/dgmrp_plot_ps_48379d5b6e72c0761453109897580e48.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/dgmrp_plot_ps_48379d5b6e72c0761453109897580e48.RData -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/dgmrp_plot_ps_48379d5b6e72c0761453109897580e48.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/dgmrp_plot_ps_48379d5b6e72c0761453109897580e48.rdb -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/dgmrp_plot_ps_48379d5b6e72c0761453109897580e48.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/dgmrp_plot_ps_48379d5b6e72c0761453109897580e48.rdx -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-1_5cb3674302b7dd510debce6a556c99e6.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-1_5cb3674302b7dd510debce6a556c99e6.RData -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-1_5cb3674302b7dd510debce6a556c99e6.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-1_5cb3674302b7dd510debce6a556c99e6.rdb -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-1_5cb3674302b7dd510debce6a556c99e6.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-1_5cb3674302b7dd510debce6a556c99e6.rdx -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-2_d2b3882d4c13b01251e31186e84afb42.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-2_d2b3882d4c13b01251e31186e84afb42.RData -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-2_d2b3882d4c13b01251e31186e84afb42.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-2_d2b3882d4c13b01251e31186e84afb42.rdb -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-2_d2b3882d4c13b01251e31186e84afb42.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-2_d2b3882d4c13b01251e31186e84afb42.rdx -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-3_63bc9e1c24c2c84bc22471384debcfdf.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-3_63bc9e1c24c2c84bc22471384debcfdf.RData -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-3_63bc9e1c24c2c84bc22471384debcfdf.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-3_63bc9e1c24c2c84bc22471384debcfdf.rdb -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-3_63bc9e1c24c2c84bc22471384debcfdf.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-3_63bc9e1c24c2c84bc22471384debcfdf.rdx -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-4_0446b9ea55aac86d4cbaed55d9f02197.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-4_0446b9ea55aac86d4cbaed55d9f02197.RData -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-4_0446b9ea55aac86d4cbaed55d9f02197.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-4_0446b9ea55aac86d4cbaed55d9f02197.rdb -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-4_0446b9ea55aac86d4cbaed55d9f02197.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-4_0446b9ea55aac86d4cbaed55d9f02197.rdx -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-5_2b212393f7107bba7048815f753f7f47.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-5_2b212393f7107bba7048815f753f7f47.RData -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-5_2b212393f7107bba7048815f753f7f47.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-5_2b212393f7107bba7048815f753f7f47.rdb -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-5_2b212393f7107bba7048815f753f7f47.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-5_2b212393f7107bba7048815f753f7f47.rdx -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-6_77653c8f061f6bf4e238e8b425770005.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-6_77653c8f061f6bf4e238e8b425770005.RData -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-6_77653c8f061f6bf4e238e8b425770005.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-6_77653c8f061f6bf4e238e8b425770005.rdb -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-6_77653c8f061f6bf4e238e8b425770005.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-6_77653c8f061f6bf4e238e8b425770005.rdx -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-7_17ef96e7728b26ce39393a638710c244.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-7_17ef96e7728b26ce39393a638710c244.RData -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-7_17ef96e7728b26ce39393a638710c244.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-7_17ef96e7728b26ce39393a638710c244.rdb -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-7_17ef96e7728b26ce39393a638710c244.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-7_17ef96e7728b26ce39393a638710c244.rdx -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-8_dcf5ba59ce6afc2f85982cb3db9db27f.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-8_dcf5ba59ce6afc2f85982cb3db9db27f.RData -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-8_dcf5ba59ce6afc2f85982cb3db9db27f.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-8_dcf5ba59ce6afc2f85982cb3db9db27f.rdb -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-8_dcf5ba59ce6afc2f85982cb3db9db27f.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-8_dcf5ba59ce6afc2f85982cb3db9db27f.rdx -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-9_25fa8d3779010458dc7dc284f28cb49d.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-9_25fa8d3779010458dc7dc284f28cb49d.RData -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-9_25fa8d3779010458dc7dc284f28cb49d.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-9_25fa8d3779010458dc7dc284f28cb49d.rdb -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_cache/html/unnamed-chunk-9_25fa8d3779010458dc7dc284f28cb49d.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_cache/html/unnamed-chunk-9_25fa8d3779010458dc7dc284f28cb49d.rdx -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_files/figure-html/dgmrp_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_files/figure-html/dgmrp_plot-1.png -------------------------------------------------------------------------------- /docs/articles/abortion_attitudes_files/figure-html/dgmrp_plot_ps-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/abortion_attitudes_files/figure-html/dgmrp_plot_ps-1.png -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Articles • dgo 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 | 44 | 45 | 46 | 47 | 48 | 49 |
50 |
51 | 94 | 95 | 96 |
97 | 98 |
99 |
100 | 103 | 104 |
105 |

All vignettes

106 |

107 | 108 | 112 |
113 |
114 |
115 | 116 | 126 |
127 | 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/__packages: -------------------------------------------------------------------------------- 1 | base 2 | dgodata 3 | ggplot2 4 | StanHeaders 5 | rstan 6 | dgo 7 | -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/dgirt_plot_1ddc8361c9582fd966b2bd4f099bd6a1.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/dgirt_plot_1ddc8361c9582fd966b2bd4f099bd6a1.RData -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/dgirt_plot_1ddc8361c9582fd966b2bd4f099bd6a1.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/dgirt_plot_1ddc8361c9582fd966b2bd4f099bd6a1.rdb -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/dgirt_plot_1ddc8361c9582fd966b2bd4f099bd6a1.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/dgirt_plot_1ddc8361c9582fd966b2bd4f099bd6a1.rdx -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/dgirt_plot_ps_edac3c455ee40136d9b3a133f958a6c8.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/dgirt_plot_ps_edac3c455ee40136d9b3a133f958a6c8.RData -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/dgirt_plot_ps_edac3c455ee40136d9b3a133f958a6c8.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/dgirt_plot_ps_edac3c455ee40136d9b3a133f958a6c8.rdb -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/dgirt_plot_ps_edac3c455ee40136d9b3a133f958a6c8.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/dgirt_plot_ps_edac3c455ee40136d9b3a133f958a6c8.rdx -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-1_7f7f7b7846be6c23b0eac5c9f71dd35d.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-1_7f7f7b7846be6c23b0eac5c9f71dd35d.RData -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-1_7f7f7b7846be6c23b0eac5c9f71dd35d.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-1_7f7f7b7846be6c23b0eac5c9f71dd35d.rdb -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-1_7f7f7b7846be6c23b0eac5c9f71dd35d.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-1_7f7f7b7846be6c23b0eac5c9f71dd35d.rdx -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-2_abe6ef06e1b0721c2f4612946d61d1e1.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-2_abe6ef06e1b0721c2f4612946d61d1e1.RData -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-2_abe6ef06e1b0721c2f4612946d61d1e1.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-2_abe6ef06e1b0721c2f4612946d61d1e1.rdb -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-2_abe6ef06e1b0721c2f4612946d61d1e1.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-2_abe6ef06e1b0721c2f4612946d61d1e1.rdx -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-3_5e042dc3fdbbdb23e9a63b08c31c2db7.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-3_5e042dc3fdbbdb23e9a63b08c31c2db7.RData -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-3_5e042dc3fdbbdb23e9a63b08c31c2db7.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-3_5e042dc3fdbbdb23e9a63b08c31c2db7.rdb -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-3_5e042dc3fdbbdb23e9a63b08c31c2db7.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-3_5e042dc3fdbbdb23e9a63b08c31c2db7.rdx -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-4_48e27a99cc898a34897e047e7c0ff6b9.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-4_48e27a99cc898a34897e047e7c0ff6b9.RData -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-4_48e27a99cc898a34897e047e7c0ff6b9.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-4_48e27a99cc898a34897e047e7c0ff6b9.rdb -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-4_48e27a99cc898a34897e047e7c0ff6b9.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-4_48e27a99cc898a34897e047e7c0ff6b9.rdx -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-5_afac86a88dc31791a80d502b3016574b.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-5_afac86a88dc31791a80d502b3016574b.RData -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-5_afac86a88dc31791a80d502b3016574b.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-5_afac86a88dc31791a80d502b3016574b.rdb -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-5_afac86a88dc31791a80d502b3016574b.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-5_afac86a88dc31791a80d502b3016574b.rdx -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-6_88f945ece342819ae91d0f11859b9523.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-6_88f945ece342819ae91d0f11859b9523.RData -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-6_88f945ece342819ae91d0f11859b9523.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-6_88f945ece342819ae91d0f11859b9523.rdb -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-6_88f945ece342819ae91d0f11859b9523.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-6_88f945ece342819ae91d0f11859b9523.rdx -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-7_4134e80a3b05a719181ae42dc923b9ae.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-7_4134e80a3b05a719181ae42dc923b9ae.RData -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-7_4134e80a3b05a719181ae42dc923b9ae.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-7_4134e80a3b05a719181ae42dc923b9ae.rdb -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-7_4134e80a3b05a719181ae42dc923b9ae.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-7_4134e80a3b05a719181ae42dc923b9ae.rdx -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-8_73631e93f55e8d3fe2110bf282c796e6.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-8_73631e93f55e8d3fe2110bf282c796e6.RData -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-8_73631e93f55e8d3fe2110bf282c796e6.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-8_73631e93f55e8d3fe2110bf282c796e6.rdb -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-8_73631e93f55e8d3fe2110bf282c796e6.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-8_73631e93f55e8d3fe2110bf282c796e6.rdx -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-9_65b67d4e9a07590b8b28a91c94646f7b.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-9_65b67d4e9a07590b8b28a91c94646f7b.RData -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-9_65b67d4e9a07590b8b28a91c94646f7b.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-9_65b67d4e9a07590b8b28a91c94646f7b.rdb -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_cache/html/unnamed-chunk-9_65b67d4e9a07590b8b28a91c94646f7b.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_cache/html/unnamed-chunk-9_65b67d4e9a07590b8b28a91c94646f7b.rdx -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_files/figure-html/dgirt_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_files/figure-html/dgirt_plot-1.png -------------------------------------------------------------------------------- /docs/articles/policy_liberalism_files/figure-html/dgirt_plot_ps-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/docs/articles/policy_liberalism_files/figure-html/dgirt_plot_ps-1.png -------------------------------------------------------------------------------- /docs/authors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Authors • dgo 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 | 44 | 45 | 46 | 47 | 48 | 49 |
50 |
51 | 94 | 95 | 96 |
97 | 98 |
99 |
100 | 103 | 104 | 118 | 119 |
120 | 121 |
122 | 123 | 124 | 134 |
135 | 136 | 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/jquery.sticky-kit.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net 3 | */ 4 | (function(){var b,f;b=this.jQuery||window.jQuery;f=b(window);b.fn.stick_in_parent=function(d){var A,w,J,n,B,K,p,q,k,E,t;null==d&&(d={});t=d.sticky_class;B=d.inner_scrolling;E=d.recalc_every;k=d.parent;q=d.offset_top;p=d.spacer;w=d.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=b(document);null==w&&(w=!0);J=function(a,d,n,C,F,u,r,G){var v,H,m,D,I,c,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k)); 5 | if(!g.length)throw"failed to find stick parent";v=m=!1;(h=null!=p?p&&a.closest(p):b("
"))&&h.css("position",a.css("position"));x=function(){var c,f,e;if(!G&&(I=A.height(),c=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),d=parseInt(g.css("padding-bottom"),10),n=g.offset().top+c+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q, 6 | u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:a.outerWidth(!0),height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,c=q,z=E,l=function(){var b,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+c>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),eb&&!v&&(c-=l,c=Math.max(b-u,c),c=Math.min(q,c),m&&a.css({top:c+"px"})))):e>F&&(m=!0,b={position:"fixed",top:c},b.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(b).addClass(t),null==p&&(a.after(h),"left"!==r&&"right"!==r||h.append(a)),a.trigger("sticky_kit:stick")),m&&w&&(null==k&&(k=e+u+c>C+n),!v&&k)))return v=!0,"static"===g.css("position")&&g.css({position:"relative"}), 8 | a.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")},y=function(){x();return l()},H=function(){G=!0;f.off("touchmove",l);f.off("scroll",l);f.off("resize",y);b(document.body).off("sticky_kit:recalc",y);a.off("sticky_kit:detach",H);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});g.position("position","");if(m)return null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.remove()),a.removeClass(t)},f.on("touchmove",l),f.on("scroll",l),f.on("resize", 9 | y),b(document.body).on("sticky_kit:recalc",y),a.on("sticky_kit:detach",H),setTimeout(l,0)}};n=0;for(K=this.length;n 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/pkgdown.css: -------------------------------------------------------------------------------- 1 | /* Sticky footer */ 2 | 3 | /** 4 | * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ 5 | * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css 6 | * 7 | * .Site -> body > .container 8 | * .Site-content -> body > .container .row 9 | * .footer -> footer 10 | * 11 | * Key idea seems to be to ensure that .container and __all its parents__ 12 | * have height set to 100% 13 | * 14 | */ 15 | 16 | html, body { 17 | height: 100%; 18 | } 19 | 20 | body > .container { 21 | display: flex; 22 | height: 100%; 23 | flex-direction: column; 24 | 25 | padding-top: 60px; 26 | } 27 | 28 | body > .container .row { 29 | flex: 1 0 auto; 30 | } 31 | 32 | footer { 33 | margin-top: 45px; 34 | padding: 35px 0 36px; 35 | border-top: 1px solid #e5e5e5; 36 | color: #666; 37 | display: flex; 38 | flex-shrink: 0; 39 | } 40 | footer p { 41 | margin-bottom: 0; 42 | } 43 | footer div { 44 | flex: 1; 45 | } 46 | footer .pkgdown { 47 | text-align: right; 48 | } 49 | footer p { 50 | margin-bottom: 0; 51 | } 52 | 53 | img.icon { 54 | float: right; 55 | } 56 | 57 | img { 58 | max-width: 100%; 59 | } 60 | 61 | /* Typographic tweaking ---------------------------------*/ 62 | 63 | .contents h1.page-header { 64 | margin-top: calc(-60px + 1em); 65 | } 66 | 67 | /* Section anchors ---------------------------------*/ 68 | 69 | a.anchor { 70 | margin-left: -30px; 71 | display:inline-block; 72 | width: 30px; 73 | height: 30px; 74 | visibility: hidden; 75 | 76 | background-image: url(./link.svg); 77 | background-repeat: no-repeat; 78 | background-size: 20px 20px; 79 | background-position: center center; 80 | } 81 | 82 | .hasAnchor:hover a.anchor { 83 | visibility: visible; 84 | } 85 | 86 | @media (max-width: 767px) { 87 | .hasAnchor:hover a.anchor { 88 | visibility: hidden; 89 | } 90 | } 91 | 92 | 93 | /* Fixes for fixed navbar --------------------------*/ 94 | 95 | .contents h1, .contents h2, .contents h3, .contents h4 { 96 | padding-top: 60px; 97 | margin-top: -40px; 98 | } 99 | 100 | /* Static header placement on mobile devices */ 101 | @media (max-width: 767px) { 102 | .navbar-fixed-top { 103 | position: absolute; 104 | } 105 | .navbar { 106 | padding: 0; 107 | } 108 | } 109 | 110 | 111 | /* Sidebar --------------------------*/ 112 | 113 | #sidebar { 114 | margin-top: 30px; 115 | } 116 | #sidebar h2 { 117 | font-size: 1.5em; 118 | margin-top: 1em; 119 | } 120 | 121 | #sidebar h2:first-child { 122 | margin-top: 0; 123 | } 124 | 125 | #sidebar .list-unstyled li { 126 | margin-bottom: 0.5em; 127 | } 128 | 129 | .orcid { 130 | height: 16px; 131 | vertical-align: middle; 132 | } 133 | 134 | /* Reference index & topics ----------------------------------------------- */ 135 | 136 | .ref-index th {font-weight: normal;} 137 | 138 | .ref-index td {vertical-align: top;} 139 | .ref-index .alias {width: 40%;} 140 | .ref-index .title {width: 60%;} 141 | 142 | .ref-index .alias {width: 40%;} 143 | .ref-index .title {width: 60%;} 144 | 145 | .ref-arguments th {text-align: right; padding-right: 10px;} 146 | .ref-arguments th, .ref-arguments td {vertical-align: top;} 147 | .ref-arguments .name {width: 20%;} 148 | .ref-arguments .desc {width: 80%;} 149 | 150 | /* Nice scrolling for wide elements --------------------------------------- */ 151 | 152 | table { 153 | display: block; 154 | overflow: auto; 155 | } 156 | 157 | /* Syntax highlighting ---------------------------------------------------- */ 158 | 159 | pre { 160 | word-wrap: normal; 161 | word-break: normal; 162 | border: 1px solid #eee; 163 | } 164 | 165 | pre, code { 166 | background-color: #f8f8f8; 167 | color: #333; 168 | } 169 | 170 | pre code { 171 | overflow: auto; 172 | word-wrap: normal; 173 | white-space: pre; 174 | } 175 | 176 | pre .img { 177 | margin: 5px 0; 178 | } 179 | 180 | pre .img img { 181 | background-color: #fff; 182 | display: block; 183 | height: auto; 184 | } 185 | 186 | code a, pre a { 187 | color: #375f84; 188 | } 189 | 190 | a.sourceLine:hover { 191 | text-decoration: none; 192 | } 193 | 194 | .fl {color: #1514b5;} 195 | .fu {color: #000000;} /* function */ 196 | .ch,.st {color: #036a07;} /* string */ 197 | .kw {color: #264D66;} /* keyword */ 198 | .co {color: #888888;} /* comment */ 199 | 200 | .message { color: black; font-weight: bolder;} 201 | .error { color: orange; font-weight: bolder;} 202 | .warning { color: #6A0366; font-weight: bolder;} 203 | 204 | /* Clipboard --------------------------*/ 205 | 206 | .hasCopyButton { 207 | position: relative; 208 | } 209 | 210 | .btn-copy-ex { 211 | position: absolute; 212 | right: 0; 213 | top: 0; 214 | visibility: hidden; 215 | } 216 | 217 | .hasCopyButton:hover button.btn-copy-ex { 218 | visibility: visible; 219 | } 220 | 221 | /* mark.js ----------------------------*/ 222 | 223 | mark { 224 | background-color: rgba(255, 255, 51, 0.5); 225 | border-bottom: 2px solid rgba(255, 153, 51, 0.3); 226 | padding: 1px; 227 | } 228 | 229 | /* vertical spacing after htmlwidgets */ 230 | .html-widget { 231 | margin-bottom: 10px; 232 | } 233 | -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $("#sidebar") 6 | .stick_in_parent({offset_top: 40}) 7 | .on('sticky_kit:bottom', function(e) { 8 | $(this).parent().css('position', 'static'); 9 | }) 10 | .on('sticky_kit:unbottom', function(e) { 11 | $(this).parent().css('position', 'relative'); 12 | }); 13 | 14 | $('body').scrollspy({ 15 | target: '#sidebar', 16 | offset: 60 17 | }); 18 | 19 | $('[data-toggle="tooltip"]').tooltip(); 20 | 21 | var cur_path = paths(location.pathname); 22 | var links = $("#navbar ul li a"); 23 | var max_length = -1; 24 | var pos = -1; 25 | for (var i = 0; i < links.length; i++) { 26 | if (links[i].getAttribute("href") === "#") 27 | continue; 28 | var path = paths(links[i].pathname); 29 | 30 | var length = prefix_length(cur_path, path); 31 | if (length > max_length) { 32 | max_length = length; 33 | pos = i; 34 | } 35 | } 36 | 37 | // Add class to parent
  • , and enclosing
  • if in dropdown 38 | if (pos >= 0) { 39 | var menu_anchor = $(links[pos]); 40 | menu_anchor.parent().addClass("active"); 41 | menu_anchor.closest("li.dropdown").addClass("active"); 42 | } 43 | }); 44 | 45 | function paths(pathname) { 46 | var pieces = pathname.split("/"); 47 | pieces.shift(); // always starts with / 48 | 49 | var end = pieces[pieces.length - 1]; 50 | if (end === "index.html" || end === "") 51 | pieces.pop(); 52 | return(pieces); 53 | } 54 | 55 | function prefix_length(needle, haystack) { 56 | if (needle.length > haystack.length) 57 | return(0); 58 | 59 | // Special case for length-0 haystack, since for loop won't run 60 | if (haystack.length === 0) { 61 | return(needle.length === 0 ? 1 : 0); 62 | } 63 | 64 | for (var i = 0; i < haystack.length; i++) { 65 | if (needle[i] != haystack[i]) 66 | return(i); 67 | } 68 | 69 | return(haystack.length); 70 | } 71 | 72 | /* Clipboard --------------------------*/ 73 | 74 | function changeTooltipMessage(element, msg) { 75 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 76 | element.setAttribute('data-original-title', msg); 77 | $(element).tooltip('show'); 78 | element.setAttribute('data-original-title', tooltipOriginalTitle); 79 | } 80 | 81 | if(Clipboard.isSupported()) { 82 | $(document).ready(function() { 83 | var copyButton = ""; 84 | 85 | $(".examples, div.sourceCode").addClass("hasCopyButton"); 86 | 87 | // Insert copy buttons: 88 | $(copyButton).prependTo(".hasCopyButton"); 89 | 90 | // Initialize tooltips: 91 | $('.btn-copy-ex').tooltip({container: 'body'}); 92 | 93 | // Initialize clipboard: 94 | var clipboardBtnCopies = new Clipboard('[data-clipboard-copy]', { 95 | text: function(trigger) { 96 | return trigger.parentNode.textContent; 97 | } 98 | }); 99 | 100 | clipboardBtnCopies.on('success', function(e) { 101 | changeTooltipMessage(e.trigger, 'Copied!'); 102 | e.clearSelection(); 103 | }); 104 | 105 | clipboardBtnCopies.on('error', function() { 106 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 107 | }); 108 | }); 109 | } 110 | })(window.jQuery || window.$) 111 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.0.6 2 | pkgdown: 1.1.0 3 | pkgdown_sha: ~ 4 | articles: 5 | abortion_attitudes: abortion_attitudes.html 6 | policy_liberalism: policy_liberalism.html 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/dgirtfit-class.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A class for fitted dynamic group IRT models — dgirtfit-class • dgo 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 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 |
    55 | 98 | 99 | 100 |
    101 | 102 |
    103 |
    104 | 109 | 110 |
    111 | 112 |

    dgo 0.2.8 deprecated the dgirtfit class and replaced it with the 113 | dgirt_fit class.

    114 | 115 |
    116 | 117 | 118 | 119 |
    120 | 126 |
    127 | 128 | 138 |
    139 | 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /docs/reference/dgo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | dgo: Dynamic Estimation of Group-level Opinion — dgo • dgo 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 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 50 | 51 | 52 | 53 | 54 | 55 |
    56 |
    57 | 100 | 101 | 102 |
    103 | 104 |
    105 |
    106 | 111 | 112 |
    113 | 114 |

    Fit dynamic group-level IRT and MRP models from individual or aggregated item 115 | response data. This package handles common preprocessing tasks and extends 116 | functions for inspecting results, poststratification, and quick iteration 117 | over alternative models.

    118 | 119 |
    120 | 121 | 122 | 123 |
    124 | 130 |
    131 | 132 | 142 |
    143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /inst/dgirt_details.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/inst/dgirt_details.pdf -------------------------------------------------------------------------------- /man/dgirt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dgirt.r 3 | \name{dgirt} 4 | \alias{dgirt} 5 | \alias{dgmrp} 6 | \alias{dgmrp} 7 | \title{Fit a dynamic group IRT or single-issue MRP model} 8 | \usage{ 9 | dgirt(shaped_data, ..., separate_t = FALSE, delta_tbar_prior_mean = 0.65, 10 | delta_tbar_prior_sd = 0.25, innov_sd_delta_scale = 2.5, 11 | innov_sd_theta_scale = 2.5, version = "2017_01_04", 12 | hierarchical_model = TRUE, model = NULL) 13 | 14 | dgmrp(shaped_data, ..., separate_t = FALSE, delta_tbar_prior_mean = 0.65, 15 | delta_tbar_prior_sd = 0.25, innov_sd_delta_scale = 2.5, 16 | innov_sd_theta_scale = 2.5, version = "2017_01_04_singleissue", 17 | model = NULL) 18 | } 19 | \arguments{ 20 | \item{shaped_data}{Output from \code{\link{shape}}.} 21 | 22 | \item{...}{Further arguments, passed to \code{\link[rstan]{stan}}.} 23 | 24 | \item{separate_t}{Whether smoothing of estimates over time should be 25 | disabled. Default \code{FALSE}.} 26 | 27 | \item{delta_tbar_prior_mean}{Prior mean for \code{delta_tbar}, the normal 28 | weight on \code{theta_bar} in the previous period. Default \code{0.65}.} 29 | 30 | \item{delta_tbar_prior_sd}{Prior standard deviation for \code{delta_bar}. 31 | Default \code{0.25}.} 32 | 33 | \item{innov_sd_delta_scale}{Prior scale for \code{sd_innov_delta}, the Cauchy 34 | innovation standard deviation of \code{nu_geo} and \code{delta_gamma}. 35 | Default \code{2.5}.} 36 | 37 | \item{innov_sd_theta_scale}{Prior scale for \code{sd_innov_theta}, the Cauchy 38 | innovation standard deviation of \code{gamma}, \code{xi}, and if 39 | \code{constant_item} is \code{FALSE} the item difficulty \code{diff}. Default 40 | \code{2.5}.} 41 | 42 | \item{version}{The name of the dgo model to estimate, or the path to a 43 | \code{.stan} file. Valid names for dgo models are "2017_01_04", 44 | "2017_01_04_singleissue". Ignored if argument \code{model} is used.} 45 | 46 | \item{hierarchical_model}{Whether a hierarchical model should be used to 47 | smooth the group IRT estimates. If set to FALSE, the model will return raw 48 | group-IRT model estimates for each group. Default \code{TRUE}.} 49 | 50 | \item{model}{A Stan model object of class \code{stanmodel} to be used in 51 | estimation. Specifying this argument avoids repeated model compilation. Note 52 | that the Stan model object for a model fitted with \code{dgirt()} or 53 | \code{dgmrp()} can be found in the the \code{stanmodel} slot of the resulting 54 | \code{dgirt_fit} or \code{dgmrp_fit} object.} 55 | } 56 | \value{ 57 | A \code{\link{dgo_fit-class}} object that extends 58 | \code{\link[rstan]{stanfit-class}}. 59 | } 60 | \description{ 61 | \code{dgirt} and \code{dgmrp} make calls to \code{\link[rstan]{stan}} with 62 | the Stan code and data for their respective models. 63 | } 64 | \details{ 65 | The user will typically pass further arguments to \code{\link[rstan]{stan}} 66 | via the \code{...} argument, at a minimum \code{iter} and \code{cores}. 67 | 68 | By default \code{dgirt} and \code{dgmrp} override the 69 | \code{\link[rstan]{stan}} default for its \code{pars} argument to specify 70 | typical parameters of interest. They also set \code{iter_r} to \code{1L}. 71 | 72 | Important: the \code{dgirt} model assumes consistent coding of the polarity 73 | of item responses for identification. 74 | } 75 | -------------------------------------------------------------------------------- /man/dgirt_fit-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/class-dgirt_fit.r 3 | \docType{class} 4 | \name{dgirt_fit-class} 5 | \alias{dgirt_fit-class} 6 | \alias{dgirt_fit} 7 | \title{A class for fitted dynamic group IRT models} 8 | \description{ 9 | \code{\link{dgirt}} returns a fitted model object of class \code{dgirt_fit}, 10 | which inherits from \code{\link{dgo_fit}}. 11 | } 12 | \details{ 13 | dgo 0.2.8 deprecated the \code{dgirtfit} class and replaced it with the 14 | \code{\link{dgirt_fit}} class. 15 | } 16 | \section{Slots}{ 17 | 18 | \describe{ 19 | \item{\code{dgirt_in}}{\code{\link{dgirtin-class}} data used to fit the model.} 20 | }} 21 | 22 | \examples{ 23 | data(toy_dgirtfit) 24 | # summarize the fitted results 25 | summary(toy_dgirtfit, pars = 'xi') 26 | 27 | # get posterior means with a convenience function 28 | get_posterior_mean(toy_dgirtfit, pars = 'theta_bar') 29 | 30 | # generally apply functions to posterior samples after warmup; n.b. 31 | # `as.array` is iterations x chains x parameters so `MARGIN = 3` applies 32 | # `FUN` over iterations and chains 33 | apply(as.array(toy_dgirtfit, pars = 'xi'), 3, mean) 34 | 35 | # access the posterior samples 36 | head(as.data.frame(toy_dgirtfit, pars = 'theta_bar')) 37 | } 38 | \seealso{ 39 | \code{\link{dgmrp_fit}} \code{\link{dgo_fit}} 40 | } 41 | -------------------------------------------------------------------------------- /man/dgirtfit-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/class-dgirt_fit.r 3 | \docType{class} 4 | \name{dgirtfit-class} 5 | \alias{dgirtfit-class} 6 | \alias{dgirtfit} 7 | \title{A class for fitted dynamic group IRT models} 8 | \description{ 9 | dgo 0.2.8 deprecated the \code{dgirtfit} class and replaced it with the 10 | \code{\link{dgirt_fit}} class. 11 | } 12 | -------------------------------------------------------------------------------- /man/dgirtin-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/class-dgirtin.r, R/methods-dgirtin.r 3 | \docType{methods} 4 | \name{dgirtin-class} 5 | \alias{dgirtin-class} 6 | \alias{dgirtin-class,} 7 | \alias{get_item_n,} 8 | \alias{get_item_names,} 9 | \alias{get_n,} 10 | \alias{dgirtIn-method,} 11 | \alias{print.dgirtIn,} 12 | \alias{summary} 13 | \alias{summary,dgirtIn-method} 14 | \alias{print} 15 | \alias{print,dgirtIn-method} 16 | \alias{get_item_names} 17 | \alias{get_item_names,dgirtIn-method} 18 | \alias{get_item_names} 19 | \alias{get_n} 20 | \alias{get_n,dgirtIn-method} 21 | \alias{get_n} 22 | \alias{get_item_n} 23 | \alias{get_item_n,dgirtIn-method} 24 | \alias{get_item_n} 25 | \alias{show,dgirtIn-method} 26 | \title{A class for data ready to model} 27 | \usage{ 28 | summary(object, ...) 29 | 30 | \S4method{summary}{dgirtIn}(object, ...) 31 | 32 | print(x, ...) 33 | 34 | \S4method{print}{dgirtIn}(x, ...) 35 | 36 | get_item_names(x) 37 | 38 | \S4method{get_item_names}{dgirtIn}(x) 39 | 40 | get_n(x, by = NULL, aggregate_name = NULL) 41 | 42 | \S4method{get_n}{dgirtIn}(x, by = NULL, aggregate_name = NULL) 43 | 44 | get_item_n(x, by = NULL, aggregate_data = FALSE) 45 | 46 | \S4method{get_item_n}{dgirtIn}(x, by = NULL, aggregate_data = FALSE) 47 | 48 | \S4method{show}{dgirtIn}(object) 49 | } 50 | \arguments{ 51 | \item{object}{An object of class \code{dgirtIn} as returned by \code{shape}.} 52 | 53 | \item{...}{Unused.} 54 | 55 | \item{x}{An object of class \code{dgirtIn} as returned by \code{shape}.} 56 | 57 | \item{by}{The name of a grouping variable.} 58 | 59 | \item{aggregate_name}{If specified \code{get_n} will operate on the table 60 | passed to \code{shape} as \code{aggregate_data} instead of on the individual 61 | data and count nonmissingness in the given variable.} 62 | 63 | \item{aggregate_data}{If specified \code{get_item_n} will operate on the table passed 64 | to \code{shape} as \code{aggregate_data} instead of on the individual data.} 65 | } 66 | \value{ 67 | A list of item names. 68 | } 69 | \description{ 70 | \code{shape()} generates objects of class \code{dgirtIn} for modeling with 71 | \code{dgirt()} and \code{dgmrp()}. 72 | } 73 | \examples{ 74 | data(toy_dgirt_in) 75 | get_item_names(toy_dgirt_in) 76 | get_n(toy_dgirt_in) 77 | get_n(toy_dgirt_in, by = "year") 78 | get_n(toy_dgirt_in, by = "source") 79 | get_item_n(toy_dgirt_in) 80 | get_item_n(toy_dgirt_in, by = "year") 81 | data(toy_dgirt_in) 82 | get_item_names(toy_dgirt_in) 83 | # respondent count 84 | data(toy_dgirt_in) 85 | get_n(toy_dgirt_in) 86 | 87 | # respondent count by year 88 | get_n(toy_dgirt_in, by = "year") 89 | 90 | # respondent count by year and survey identifier 91 | get_n(toy_dgirt_in, by = c("year", "source")) 92 | 93 | data(toy_dgirt_in) 94 | get_item_n(toy_dgirt_in) 95 | get_item_n(toy_dgirt_in, by = "year") 96 | } 97 | -------------------------------------------------------------------------------- /man/dgmrp_fit-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/class-dgmrp_fit.r 3 | \docType{class} 4 | \name{dgmrp_fit-class} 5 | \alias{dgmrp_fit-class} 6 | \alias{dgmrp_fit} 7 | \title{A class for fitted dynamic group MRP models} 8 | \description{ 9 | \code{\link{dgmrp}} returns a fitted model object of class \code{dgmrp_fit}, 10 | which inherits from \code{\link{dgo_fit}}. 11 | } 12 | \section{Slots}{ 13 | 14 | \describe{ 15 | \item{\code{dgirt_in}}{\code{\link{dgirtin-class}} data used to fit the model.} 16 | }} 17 | 18 | \seealso{ 19 | \code{\link{dgirt_fit}} \code{\link{dgo_fit}} 20 | } 21 | -------------------------------------------------------------------------------- /man/dgo.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/package.R 3 | \docType{package} 4 | \name{dgo} 5 | \alias{dgo} 6 | \alias{dgo-package} 7 | \title{dgo: Dynamic Estimation of Group-level Opinion} 8 | \description{ 9 | Fit dynamic group-level IRT and MRP models from individual or aggregated item 10 | response data. This package handles common preprocessing tasks and extends 11 | functions for inspecting results, poststratification, and quick iteration 12 | over alternative models. 13 | } 14 | -------------------------------------------------------------------------------- /man/dgo_fit-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/class-dgo_fit.r 3 | \docType{class} 4 | \name{dgo_fit-class} 5 | \alias{dgo_fit-class} 6 | \alias{dgo_fit} 7 | \title{A class for fitted models} 8 | \description{ 9 | \code{dgo_fit} is a superclass for \code{\link{dgirt_fit}} and 10 | \code{\link{dgmrp_fit}} that inherits from the 11 | \code{\link[rstan]{stanfit-class}} in the \code{\link{rstan}} package. 12 | } 13 | \section{Slots}{ 14 | 15 | \describe{ 16 | \item{\code{dgirt_in}}{\code{\link{dgirtin-class}} data used to fit the model.} 17 | 18 | \item{\code{call}}{The function call that returned the \code{dgo_fit} object.} 19 | }} 20 | 21 | \seealso{ 22 | \code{\link{dgmrp_fit}} \code{\link{dgo_fit}} 23 | } 24 | -------------------------------------------------------------------------------- /man/dgo_fit-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-dgirtfit.r 3 | \docType{methods} 4 | \name{show,dgo_fit-method} 5 | \alias{show,dgo_fit-method} 6 | \alias{print,dgo_fit-method} 7 | \alias{print.dgo_fit} 8 | \alias{get_elapsed_time,dgo_fit-method} 9 | \alias{summary,dgo_fit-method} 10 | \alias{get_posterior_mean,dgo_fit-method} 11 | \alias{summarize} 12 | \alias{summarize,dgo_fit-method} 13 | \alias{as.data.frame.dgo_fit} 14 | \alias{rhats} 15 | \alias{rhats,dgo_fit-method} 16 | \title{\code{print} method for \code{dgo_fit-class} objects} 17 | \usage{ 18 | \S4method{show}{dgo_fit}(object) 19 | 20 | \S4method{print}{dgo_fit}(x, ...) 21 | 22 | print.dgo_fit(x, ...) 23 | 24 | \S4method{get_elapsed_time}{dgo_fit}(object, ...) 25 | 26 | \S4method{summary}{dgo_fit}(object, ..., verbose = FALSE) 27 | 28 | \S4method{get_posterior_mean}{dgo_fit}(object, pars = "theta_bar", ...) 29 | 30 | summarize(x, ...) 31 | 32 | \S4method{summarize}{dgo_fit}(x, pars = "theta_bar", funs = c("mean", "sd", 33 | "median", "q_025", "q_975")) 34 | 35 | \method{as.data.frame}{dgo_fit}(x, ..., pars = "theta_bar", 36 | keep.rownames = FALSE) 37 | 38 | rhats(x, ...) 39 | 40 | \S4method{rhats}{dgo_fit}(x, pars = "theta_bar") 41 | } 42 | \arguments{ 43 | \item{object}{A \code{dgo_fit-class} object} 44 | 45 | \item{x}{A \code{dgo_fit-class} object} 46 | 47 | \item{...}{Further arguments to \code{\link{stanfit-class}} methods.} 48 | 49 | \item{verbose}{Whether to show the full output from the \code{rstan} method.} 50 | 51 | \item{pars}{Parameter name(s)} 52 | 53 | \item{funs}{Quoted names of summary functions. `q_025` is accepted as 54 | shorthand for `function(x) quantile(x, .025)`, and similarly `q_975`.} 55 | 56 | \item{keep.rownames}{Whether to retain original parameter names with numeric 57 | indexes, as output from RStan.} 58 | } 59 | \value{ 60 | A table giving split R-hats for model parameters 61 | } 62 | \description{ 63 | \code{print} method for \code{dgo_fit-class} objects 64 | 65 | \code{get_elapsed_time}: extract chain run times from \code{dgo_fit}-class 66 | objects 67 | 68 | \code{summary} method for \code{dgo_fit-class} objects 69 | 70 | \code{summarize} method for \code{dgo_fit-class} objects 71 | 72 | \code{as.data.frame} method for \code{dgo_fit-class} objects 73 | 74 | \code{rhats}: extract split R-hats from \code{dgo_fit}-class objects 75 | } 76 | \examples{ 77 | data(toy_dgirtfit) 78 | summarize(toy_dgirtfit) 79 | data(toy_dgirtfit) 80 | # access posterior samples 81 | as.data.frame(toy_dgirtfit, pars = 'theta_bar') 82 | data(toy_dgirtfit) 83 | rhats(toy_dgirtfit) 84 | } 85 | -------------------------------------------------------------------------------- /man/plot-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-dgirtfit-plot.r 3 | \docType{methods} 4 | \name{dgirt_plot} 5 | \alias{dgirt_plot} 6 | \alias{dgirt_plot,dgo_fit-method} 7 | \alias{dgirt_plot,data.frame-method} 8 | \alias{plot,dgo_fit,missing-method} 9 | \alias{plot_rhats} 10 | \alias{plot_rhats,dgo_fit-method} 11 | \title{Plot estimates and diagnostic statistics} 12 | \usage{ 13 | dgirt_plot(x, ...) 14 | 15 | \S4method{dgirt_plot}{dgo_fit}(x, y_fun = "median", y_min = "q_025", 16 | y_max = "q_975", pars = "theta_bar") 17 | 18 | \S4method{dgirt_plot}{data.frame}(x, group_name, time_name, geo_name, 19 | y_fun = "median", y_min = "q_025", y_max = "q_975") 20 | 21 | \S4method{plot}{dgo_fit,missing}(x, y, ...) 22 | 23 | plot_rhats(x, ...) 24 | 25 | \S4method{plot_rhats}{dgo_fit}(x, pars = "theta_bar", facet_vars = NULL, 26 | shape_var = NULL, color_var = NULL, x_var = NULL) 27 | } 28 | \arguments{ 29 | \item{x}{A \code{dgo_fit-class} object.} 30 | 31 | \item{...}{Further arguments to \code{\link{dgirt_plot}}.} 32 | 33 | \item{y_fun}{Summary function to be plotted as \code{y}.} 34 | 35 | \item{y_min}{Summary function giving the \code{ymin} argument for a 36 | \code{geom_pointrange} object.} 37 | 38 | \item{y_max}{Summary function giving the \code{ymax} argument for a 39 | \code{geom_pointrange} object.} 40 | 41 | \item{pars}{Selected parameter.} 42 | 43 | \item{group_name}{A discrete grouping variable that will be passed to the 44 | \code{color} argument of \code{aes}.} 45 | 46 | \item{time_name}{A time variable with numeric values that will be plotted on 47 | the x axis.} 48 | 49 | \item{geo_name}{A variable representing local areas that will be used in 50 | faceting.} 51 | 52 | \item{y}{Ignored.} 53 | 54 | \item{facet_vars}{Optionally, one or more variables passed to \code{facet_wrap}} 55 | 56 | \item{shape_var, color_var, x_var}{Optionally, a variable passed to the 57 | \code{shape}, \code{color}, or \code{x} arguments of \code{aes_string}, 58 | respectively.} 59 | } 60 | \description{ 61 | \code{dgirt_plot} plots estimates from a dgo model. \code{plot_rhats} plots 62 | split R-hats. 63 | } 64 | \examples{ 65 | \dontrun{ 66 | data(toy_dgirtfit) 67 | dgirt_plot(toy_dgirtfit) 68 | dgirt_plot(toy_dgirtfit, y_min = NULL, y_max = NULL) 69 | p <- dgirt_plot(toy_dgirtfit) 70 | p \%+\% ylab("posterior median") 71 | } 72 | \dontrun{ 73 | data(toy_dgirtfit) 74 | ps <- poststratify(toy_dgirtfit, annual_state_race_targets, strata_names = 75 | c("state", "year"), aggregated_names = "race3") 76 | dgirt_plot(ps, group_name = NULL, time_name = "year", geo_name = "state") 77 | } 78 | \dontrun{ 79 | data(toy_dgirtfit) 80 | plot(toy_dgirtfit) 81 | } 82 | \dontrun{ 83 | data(toy_dgirtfit) 84 | plot_rhats(toy_dgirtfit) 85 | plot_rhats(toy_dgirtfit, facet_vars = "race3") + 86 | scale_x_continuous(breaks = seq.int(2006, 2008)) 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /man/poststratify.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/methods-dgirtfit-poststratify.r 3 | \docType{methods} 4 | \name{poststratify} 5 | \alias{poststratify} 6 | \alias{poststratify,dgo_fit-method} 7 | \alias{poststratify,data.frame-method} 8 | \title{Reweight and aggregate estimates} 9 | \usage{ 10 | poststratify(x, target_data, strata_names, aggregated_names, 11 | proportion_name = "proportion", ...) 12 | 13 | \S4method{poststratify}{dgo_fit}(x, target_data, strata_names, aggregated_names, 14 | proportion_name = "proportion", pars = "theta_bar") 15 | 16 | \S4method{poststratify}{data.frame}(x, target_data, strata_names, 17 | aggregated_names, proportion_name = "proportion") 18 | } 19 | \arguments{ 20 | \item{x}{A \code{data.frame} or \code{dgo_fit} object.} 21 | 22 | \item{target_data}{A table giving the proportions contributed to strata by 23 | the interaction of \code{strata_names} and \code{aggregated_names}.} 24 | 25 | \item{strata_names}{Names of variables whose interaction defines 26 | population strata.} 27 | 28 | \item{aggregated_names}{Names of variables to be aggregated over in 29 | poststratification.} 30 | 31 | \item{proportion_name}{Name of the column in \code{target_data} that gives 32 | strata proportions.} 33 | 34 | \item{...}{Additional arguments to methods.} 35 | 36 | \item{pars}{Selected parameter names.} 37 | } 38 | \value{ 39 | A table of poststratified estimates. 40 | } 41 | \description{ 42 | This function reweights and aggregates estimates from \code{dgirt} for strata 43 | defined by modeled variables. The names of each of the model's time, 44 | geographic, and demographic grouping variables can be given in either the 45 | \code{strata_names} or \code{aggregated_names} argument. The result has 46 | estimates for the strata indicated by the \code{strata_names} argument, 47 | aggregated over the variables specified in \code{aggregated_names}. 48 | \code{poststratify} requires a table given as \code{target_data} with 49 | population proportions for the interaction of the variables given in 50 | \code{strata_names} and \code{aggregated_names}. 51 | } 52 | \examples{ 53 | \dontrun{ 54 | data(toy_dgirtfit) 55 | 56 | # the stratifying variables should uniquely identify proportions in the 57 | # target data; to achieve this, sum over the other variables 58 | targets <- aggregate(proportion ~ state + year + race3, targets, sum) 59 | 60 | # the dgirtfit method of poststratify takes a dgirtfit object, the target 61 | # data, the names of variables that define population strata, and the names 62 | # of variables to be aggregated over 63 | post <- poststratify(toy_dgirtfit, targets, c("state", "year"), "race3") 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /man/toy_dgirt_in.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/toy_dgirt_in.r 3 | \docType{data} 4 | \name{toy_dgirt_in} 5 | \alias{toy_dgirt_in} 6 | \title{A minimal example of shaped data} 7 | \format{A \code{\link[dgo]{dgirtin-class}} object.} 8 | \usage{ 9 | toy_dgirt_in 10 | } 11 | \description{ 12 | \code{\link[dgo]{shape}} returns a \code{\link[dgo]{dgirtin-class}} object 13 | used with \code{\link[dgo]{dgirt}} for DGIRT modeling. \code{toy_dgirt_in} is 14 | a minimal \code{\link[dgo]{dgirtin-class}} object for use in examples. 15 | } 16 | -------------------------------------------------------------------------------- /man/toy_dgirtfit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/toy_dgirtfit.r 3 | \docType{data} 4 | \name{toy_dgirtfit} 5 | \alias{toy_dgirtfit} 6 | \title{A minimal example of a fitted model} 7 | \format{A \code{\link[dgo]{dgirtfit-class}} object.} 8 | \usage{ 9 | toy_dgirtfit 10 | } 11 | \description{ 12 | \code{\link[dgo]{dgirt}} returns a \code{\link[dgo]{dgirtfit}}-class object 13 | that extends \code{\link[rstan]{stanfit-class}}. \code{toy_dgirtfit} is a 14 | minimal \code{\link[dgo]{dgirtfit}} object for use in examples. 15 | } 16 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(dgo) 3 | 4 | # https://stackoverflow.com/questions/12410694/rbundler-build-error-cannot-open-file-startup-rs-no-such-file-or-directory#27994299 5 | Sys.setenv("R_TESTS" = "") 6 | test_check("dgo") 7 | -------------------------------------------------------------------------------- /tests/testthat/d_agg_n_vec.Rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/tests/testthat/d_agg_n_vec.Rds -------------------------------------------------------------------------------- /tests/testthat/d_agg_s_vec.Rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/tests/testthat/d_agg_s_vec.Rds -------------------------------------------------------------------------------- /tests/testthat/d_min_n_vec.Rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/tests/testthat/d_min_n_vec.Rds -------------------------------------------------------------------------------- /tests/testthat/d_min_s_vec.Rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/tests/testthat/d_min_s_vec.Rds -------------------------------------------------------------------------------- /tests/testthat/dgirt_ret.Rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/tests/testthat/dgirt_ret.Rds -------------------------------------------------------------------------------- /tests/testthat/dgmrp_ret.Rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/tests/testthat/dgmrp_ret.Rds -------------------------------------------------------------------------------- /tests/testthat/setup.r: -------------------------------------------------------------------------------- 1 | suppressMessages(library(data.table)) 2 | 3 | minimal_individual_data = data.table::data.table( 4 | period = rep(1:2, each = 5), 5 | geo = c(rep('A', 2), rep('B', 3)), 6 | pid = rep(c('D', 'R'), 5), 7 | item_1 = c(rep(0, 2), rep(1, 3)), 8 | item_2 = c(0, rep(1, 4)) 9 | ) 10 | 11 | minimal_aggregate_data = data.table::data.table( 12 | expand.grid(pid = c('D', 'R'), 13 | geo = c('A', 'B'), 14 | period = 1:2, 15 | item = c('item_1', 'item_2'), stringsAsFactors = FALSE), 16 | s_grp = 0:1, 17 | n_grp = 2 18 | ) 19 | 20 | extract_counts = function(dgirt_in) { 21 | counts = data.table::data.table( 22 | s_vec = dgirt_in$s_vec, 23 | n_vec = dgirt_in$n_vec, 24 | count_id = names(dgirt_in$n_vec) 25 | ) 26 | counts[, c('period', 'geo', 'pid', 'item') := tstrsplit(count_id, '__')] 27 | counts[grepl('_gt\\d+$', item), item := substr(item, 1, nchar(item) - 4)] 28 | counts[, period := as.integer(period)] 29 | counts[, count_id := NULL] 30 | setorderv(counts, c('period', 'geo', 'pid', 'item')) 31 | setcolorder(counts, c('period', 'geo', 'pid', 'item', 's_vec', 'n_vec')) 32 | counts[] 33 | } 34 | 35 | get_manual_count = function(.data, group_vars = c('period', 'geo', 'pid')) { 36 | long = melt(.data, 37 | id.vars = group_vars, 38 | variable.name = 'item', 39 | variable.factor = FALSE) 40 | setorderv(long, c(group_vars, 'item')) 41 | counts = long[, .(s_vec = sum(value), n_vec = .N), by = c(group_vars)] 42 | setcolorder(counts, c('period', 'geo', 'pid', 'item', 's_vec', 'n_vec')) 43 | counts[] 44 | } 45 | 46 | minimal_individual_result = suppressMessages(shape( 47 | item_data = minimal_individual_data, 48 | item_names = 'item_1', 49 | time_name = 'period', 50 | geo_name = 'geo', 51 | group_names = 'pid')) 52 | 53 | minimal_indiv_agg_result = suppressMessages(shape( 54 | item_data = minimal_individual_data, 55 | item_names = 'item_1', 56 | aggregate_data = minimal_aggregate_data, 57 | # FIXME: stringsAsFactors = TRUE in expand.grid above leads to error 58 | time_name = 'period', 59 | geo_name = 'geo', 60 | group_names = 'pid')) 61 | 62 | minimal_2_item_individual_result = suppressMessages(shape( 63 | item_data = minimal_individual_data, 64 | item_names = c('item_1', 'item_2'), 65 | time_name = 'period', 66 | geo_name = 'geo', 67 | group_names = 'pid')) 68 | 69 | min_item_call <- function(...) { 70 | default <- list(item_data = opinion, 71 | item_names = "abortion", 72 | time_name = "year", 73 | geo_name = "state", 74 | group_names = "female") 75 | dots <- list(...) 76 | dots <- c(dots, default[!names(default) %in% names(dots)]) 77 | invisible(do.call(shape, dots)) 78 | } 79 | 80 | min_groupless_call <- function(...) { 81 | default <- list(item_data = opinion, 82 | item_names = "abortion", 83 | time_name = "year", 84 | geo_name = "state") 85 | dots <- list(...) 86 | dots <- c(dots, default[!names(default) %in% names(dots)]) 87 | invisible(do.call(shape, dots)) 88 | } 89 | 90 | min_modifier_call <- function(...) { 91 | default <- list(item_data = opinion, 92 | item_names = "abortion", 93 | time_name = "year", 94 | geo_name = "state", 95 | group_names = "female", 96 | modifier_data = states, 97 | modifier_names = "prop_evangelicals", 98 | t1_modifier_names = "prop_evangelicals") 99 | dots <- list(...) 100 | dots <- c(dots, default[!names(default) %in% names(dots)]) 101 | invisible(do.call(shape, dots)) 102 | } 103 | 104 | min_agg_call <- function(...) { 105 | default <- list(aggregate_data = aggregates, 106 | item_data = opinion, 107 | item_names = "abortion", 108 | time_name = "year", 109 | geo_name = "state", 110 | group_names = "female") 111 | dots <- list(...) 112 | dots <- c(dots, default[!names(default) %in% names(dots)]) 113 | invisible(do.call(shape, dots)) 114 | } 115 | 116 | -------------------------------------------------------------------------------- /tests/testthat/test-assertions.r: -------------------------------------------------------------------------------- 1 | context('assertions') 2 | 3 | test_that('all_equal works', { 4 | expect_true(all_equal(1:2, 1:2)) 5 | expect_false(all_equal(1, 1:2)) 6 | expect_error(assert(all_equal(1, 1:2)), "1 and 1:2 are not all equal") 7 | }) 8 | 9 | test_that('equal_length works', { 10 | expect_true(equal_length(1:2, 1:2)) 11 | expect_false(equal_length(1, 1:2)) 12 | expect_false(equal_length(NA, 1:2)) 13 | expect_error(assert(equal_length(1, 1:2)), "1 and 1:2 have different lengths") 14 | }) 15 | 16 | test_that('is_subset works', { 17 | expect_true(is_subset(1:2, 1:2)) 18 | expect_true(is_subset(1, 1:2)) 19 | expect_false(is_subset(1:2, 1)) 20 | expect_false(is_subset(1:2, NA)) 21 | expect_error(assert(is_subset(1:2, 1)), "1:2 is not a subset of 1") 22 | }) 23 | 24 | test_that('not_empty works', { 25 | expect_true(not_empty(1:2)) 26 | expect_false(not_empty(c())) 27 | expect_false(not_empty(data.frame())) 28 | expect_error(assert(not_empty(data.frame())), "empty dimension in data.frame()") 29 | }) 30 | 31 | test_that('has_all_names works', { 32 | expect_true(has_all_names(mtcars, c('mpg', 'cyl'))) 33 | expect_false(has_all_names(mtcars, c('nm', 'cyl'))) 34 | expect_error(assert(has_all_names(mtcars, c('nm', 'cyl'))), 'not all of .* are names in mtcars') 35 | }) 36 | 37 | test_that('all_strings works', { 38 | expect_true(all_strings(c('mpg', 'cyl'))) 39 | expect_true(all_strings(list('mpg', 'cyl'))) 40 | expect_false(all_strings(character(0))) 41 | expect_false(all_strings(c('mpg', ''))) 42 | expect_error(assert(all_strings(c('mpg', ''))), 'not all positive-length strings') 43 | }) 44 | -------------------------------------------------------------------------------- /tests/testthat/test-defaults.r: -------------------------------------------------------------------------------- 1 | source("setup.r") 2 | 3 | context("default values") 4 | 5 | test_that('filters take correct defaults', { 6 | d_min <- shape(item_data = opinion, 7 | item_names = "abortion", 8 | time_name = "year", 9 | geo_name = "state", 10 | group_names = "female") 11 | expect_identical(d_min$control@time_filter, sort(unique(opinion$year))) 12 | expect_identical(d_min$control@geo_filter, sort(unique(opinion$state))) 13 | expect_identical(d_min$control@min_survey_filter, 1L) 14 | expect_identical(d_min$control@min_t_filter, 1L) 15 | }) 16 | 17 | test_that("time and geo defaults include values in aggregate_data", { 18 | data(aggregates) 19 | d_agg <- shape(aggregate_data = aggregates, 20 | item_data = opinion, 21 | item_names = "abortion", 22 | time_name = "year", 23 | geo_name = "state", 24 | group_names = c("female", "race3")) 25 | expect_equal(sort(unique(c(opinion$year, aggregates$year))), 26 | d_agg$control@time_filter) 27 | expect_equal(sort(unique(c(opinion$state, aggregates$state))), 28 | d_agg$control@geo_filter) 29 | }) 30 | 31 | test_that("time and geo defaults include disjoint values in aggregate_data", { 32 | data(aggregates) 33 | data.table::setDT(aggregates) 34 | disjoint_geo_time <- data.table::data.table( year = 0, state = "foo", race = 35 | "white", female = "male", item = "abortion", n_grp = 10, s_grp = 10) 36 | disjoint_geo_time <- data.table::rbindlist(list(aggregates, disjoint_geo_time)) 37 | 38 | d_disjoint_agg <- shape(aggregate_data = disjoint_geo_time, 39 | item_data = opinion, 40 | item_names = "abortion", 41 | time_name = "year", 42 | geo_name = "state", 43 | group_names = c("female", "race3")) 44 | expect_equal(sort(unique(c(opinion$year, 0))), d_disjoint_agg$control@time_filter) 45 | expect_equal(sort(unique(c(opinion$state, "foo"))), d_disjoint_agg$control@geo_filter) 46 | }) 47 | 48 | test_that('constant_item defaults to TRUE', { 49 | min_item_call <- shape(item_data = opinion, item_names = "abortion", 50 | time_name = "year", geo_name = "state", group_names = "female") 51 | expect_true(min_item_call$control@constant_item) 52 | }) 53 | 54 | test_that('aggregate_item_names defaults to unique items in aggregate_data', { 55 | data(aggregates) 56 | data.table::setDT(aggregates) 57 | d_agg <- shape(aggregate_data = aggregates, 58 | item_data = opinion, 59 | item_names = "abortion", 60 | time_name = "year", 61 | geo_name = "state", 62 | group_names = c("female", "race3")) 63 | expect_equal(d_agg$control@aggregate_item_names, sort(unique(aggregates[, item]))) 64 | }) 65 | 66 | test_that('zero-trial rows in aggregate data are preserved', { 67 | data(aggregates) 68 | data.table::setDT(aggregates) 69 | zeroed_row = data.frame(year = 0, state = 'GU', race3 = 'other', female = 70 | 'true', item = 'test_item', n_grp = 0, s_grp = 0, stringsAsFactors = FALSE) 71 | aggregates = data.table::rbindlist(list(aggregates, zeroed_row)) 72 | shaped = shape(aggregate_data = aggregates, time_name = "year", geo_name = 73 | "state", group_names = c("female", "race3")) 74 | expect_true(0 %in% shaped$group_grid$year) 75 | expect_true('true' %in% shaped$group_grid$female) 76 | expect_true('other' %in% shaped$group_grid$race3) 77 | expect_true('GU' %in% shaped$group_grid$state) 78 | }) 79 | -------------------------------------------------------------------------------- /tests/testthat/test-dgirt.r: -------------------------------------------------------------------------------- 1 | fit = suppressWarnings(dgirt(toy_dgirt_in, iter = 1, chains = 1)) 2 | 3 | test_that("compiled model is accessible in stanmodel slot", { 4 | expect_is(fit@stanmodel, 'stanmodel') 5 | fit_with_model = suppressWarnings(dgirt(toy_dgirt_in, iter = 1, chains = 1, 6 | model = fit@stanmodel)) 7 | expect_identical(fit@stanmodel, fit_with_model@stanmodel) 8 | }) 9 | 10 | test_that("model indicated by 'version' must exist", { 11 | expect_error( 12 | with_mock( 13 | stanc = function(...) TRUE, 14 | stan_model = function(...) TRUE, 15 | sampling = function(...) fit, 16 | suppressWarnings(dgirt(toy_dgirt_in, iter = 1, chains = 1, 17 | version = 'foo')) 18 | ), "should give the name of a model") 19 | }) 20 | 21 | test_that("version can be a model name or an arbitrary stan file", { 22 | expect_silent( 23 | with_mock( 24 | stanc = function(...) TRUE, 25 | stan_model = function(...) TRUE, 26 | sampling = function(...) fit, 27 | suppressMessages(suppressWarnings(dgirt(toy_dgirt_in, iter = 1, chains = 1, 28 | version = '2017_01_04'))) 29 | )) 30 | expect_silent( 31 | with_mock( 32 | stanc = function(...) TRUE, 33 | stan_model = function(...) TRUE, 34 | sampling = function(...) fit, 35 | suppressMessages(suppressWarnings(dgirt(toy_dgirt_in, iter = 1, chains = 1, 36 | version = 'user-version.stan'))) 37 | )) 38 | }) 39 | 40 | test_that("pars argument is passed but can be overridden", { 41 | fit = suppressWarnings(dgirt(toy_dgirt_in, iter = 1, chains = 1, 42 | model = fit@stanmodel)) 43 | expect_equivalent(fit@sim$pars_oi, c(default_pars, 'lp__')) 44 | fit_with_pars = suppressWarnings(dgirt(toy_dgirt_in, iter = 1, chains = 1, 45 | model = fit@stanmodel, pars = 'theta_bar')) 46 | expect_equivalent(fit_with_pars@sim$pars_oi, c('theta_bar', 'lp__')) 47 | }) 48 | 49 | test_that("dgmrp can't take more than one item", { 50 | expect_error(suppressWarnings(dgmrp(toy_dgirt_in, iter = 1, chains = 1, 51 | model = fit@stanmodel)), "Multiple items in item data") 52 | }) 53 | 54 | test_that("version argument is ignored when model is given", { 55 | fit_with_version = suppressWarnings(dgirt(toy_dgirt_in, iter = 1, chains = 1, 56 | model = fit@stanmodel, version = "2017_01_04_singleissue")) 57 | expect_identical(fit@stanmodel, fit_with_version@stanmodel) 58 | }) 59 | 60 | test_that("init_r defaults to 1L but can be overridden", { 61 | fit_default = suppressWarnings(dgirt(toy_dgirt_in, iter = 1, chains = 2, 62 | model = fit@stanmodel)) 63 | expect_true(all(sapply(fit_default@stan_args, `[[`, 'init_r') == 1)) 64 | fit_init_r_2 = suppressWarnings(dgirt(toy_dgirt_in, iter = 1, chains = 2, 65 | init_r = 2, model = fit@stanmodel)) 66 | expect_true(all(sapply(fit_init_r_2@stan_args, `[[`, 'init_r') == 2)) 67 | }) 68 | 69 | -------------------------------------------------------------------------------- /tests/testthat/test-dgirtfit.r: -------------------------------------------------------------------------------- 1 | context("dgirtfit class") 2 | 3 | dgirt_ret <- readRDS('dgirt_ret.Rds') 4 | dgmrp_ret <- readRDS('dgmrp_ret.Rds') 5 | 6 | test_that("dgirt returns class dgirt_fit", { 7 | expect_s4_class(dgirt_ret, "dgirt_fit") 8 | expect_s4_class(dgirt_ret, "dgo_fit") 9 | expect_true(inherits(dgirt_ret, "stanfit")) 10 | }) 11 | 12 | test_that("dgmrp returns class dgmrp_fit/dgo_fit/stanfit", { 13 | expect_s4_class(dgmrp_ret, "dgmrp_fit") 14 | expect_s4_class(dgmrp_ret, "dgo_fit") 15 | expect_true(inherits(dgmrp_ret, "stanfit")) 16 | }) 17 | 18 | for (ret in c(dgirt_ret, dgmrp_ret)) { 19 | 20 | test_that("further arguments pass to rstan via ...", { 21 | # In tools/test_objects.R, the calls to dgirt() and dgmrp() specify iter = 5 22 | # and chains = 1 23 | expect_equal(length(ret@stan_args), 1) 24 | expect_true(all(sapply(ret@stan_args, function(x) x$iter) == 5)) 25 | }) 26 | 27 | test_that("defaults pass to rstan", { 28 | expect_true(all(sapply(ret@stan_args, function(x) x$init_r) == 29 | 1L)) 30 | }) 31 | 32 | test_that("dgirt methods work", { 33 | expect_output(print(ret), "dgirt samples from") 34 | expect_output(summary(ret), "dgirt samples from") 35 | expect_is(summary(ret, verbose = TRUE), "list") 36 | tab <- get_posterior_mean(ret) 37 | expect_named(tab, c(attr(tab, "id_vars"), "mean")) 38 | }) 39 | 40 | test_that("dgirtfit and stanfit as.data.frame methods give the same values", { 41 | sf <- toy_dgirtfit 42 | class(sf) <- "stanfit" 43 | sf <- as.data.frame(sf, "theta_bar") 44 | 45 | # including warmup 46 | tab <- as.data.frame(toy_dgirtfit, discard = FALSE) 47 | data.table::setDT(tab) 48 | data.table::setorderv(tab, c("race3", "state", "year", "iteration")) 49 | 50 | expect_equal(tab$value, unname(unlist(sf))) 51 | 52 | # excluding warmup 53 | tab <- as.data.frame(toy_dgirtfit) 54 | data.table::setDT(tab) 55 | data.table::setorderv(tab, c("race3", "state", "year", "iteration")) 56 | 57 | expect_equal(tab$value, unname(unlist(sf))) 58 | }) 59 | 60 | } 61 | 62 | -------------------------------------------------------------------------------- /tests/testthat/test-dichotomize.r: -------------------------------------------------------------------------------- 1 | context("dichotomizing item responses") 2 | 3 | test_that("dichotomizing item responses works", { 4 | expect_equal(dichotomize_r(0:1), data.table::data.table(X_gt1 = 0:1)) 5 | expect_equal(dichotomize_r(NA), data.table::data.table(X_gt1 = as.numeric(NA))) 6 | expect_equal(dichotomize_r(c(1:2, NA)), data.table::data.table(X_gt1 = c(0, 1, NA))) 7 | expect_equal(dichotomize_r(c(0:1, NA)), data.table::data.table(X_gt1 = c(0, 1, NA))) 8 | expect_equal(dichotomize_r(c(0, 2, NA)), data.table::data.table(X_gt1 = c(0, 1, NA))) 9 | expect_equal(dichotomize_r(1:3), data.table::data.table(X_gt1 = c(0, 1, 1), 10 | X_gt2 = c(0, 0, 1))) 11 | expect_equal(dichotomize_r(as.factor(0:1)), data.table::data.table(X_gt1 = 0:1)) 12 | expect_equal(dichotomize_r(as.factor(NA)), data.table::data.table(X_gt1 = as.numeric(NA))) 13 | expect_equal(dichotomize_r(as.factor(c(1:2, NA))), data.table::data.table(X_gt1 = c(0, 1, NA))) 14 | expect_equal(dichotomize_r(as.factor(c(0:1, NA))), 15 | data.table::data.table(X_gt1 = c(0, 1, NA))) 16 | expect_equal(dichotomize_r(as.factor(c(0, 2, NA))), 17 | data.table::data.table(X_gt1 = c(0, 1, NA))) 18 | expect_equal(dichotomize_r(as.factor(1:3)), data.table::data.table(X_gt1 = c(0, 1, 1), 19 | X_gt2 = c(0, 0, 1))) 20 | 21 | expect_equal(dichotomize_r(as.ordered(c("a", "b"))), data.table::data.table(X_gt1 = 0:1)) 22 | expect_equal(dichotomize_r(ordered(c("a", "b"),levels = c("b", "a"))), 23 | data.table::data.table(X_gt1 = c(1, 0))) 24 | 25 | expect_warning(dichotomize_r("a"), "NAs introduced by coercion", ignore.case = TRUE) 26 | }) 27 | -------------------------------------------------------------------------------- /tests/testthat/test-input-validation.r: -------------------------------------------------------------------------------- 1 | source("setup.r") 2 | 3 | context("variation in inputs") 4 | 5 | test_that("no variation in time (a single period) is OK", { 6 | data(opinion) 7 | data.table::setDT(opinion) 8 | expect_silent(suppressMessages({ 9 | d_in = shape(opinion[year == 2006], 10 | item_names = "abortion", 11 | time_name = "year", 12 | geo_name = "state", 13 | group_names = "female", 14 | survey_name = "source", 15 | weight_name = "weight")})) 16 | }) 17 | 18 | test_that("no variation in survey identifier is OK", { 19 | data(opinion) 20 | data.table::setDT(opinion) 21 | data(targets) 22 | expect_silent(suppressMessages({ 23 | d_in = shape(opinion[source == "CCES_2006"], 24 | target_data = targets, 25 | raking = ~ state, 26 | item_names = "abortion", 27 | time_name = "year", 28 | geo_name = "state", 29 | group_names = "female", 30 | survey_name = "source", 31 | weight_name = "weight")})) 32 | }) 33 | 34 | test_that("no variation in geography produces an error", { 35 | data(opinion) 36 | data.table::setDT(opinion) 37 | expect_error(suppressMessages({ 38 | d_in = shape(opinion[state == "MA"], 39 | item_names = "abortion", 40 | time_name = "year", 41 | geo_name = "state", 42 | group_names = "female", 43 | survey_name = "source", 44 | weight_name = "weight") 45 | }), "state doesn't vary in item_data") 46 | }) 47 | 48 | test_that("no variation in grouping produces an error", { 49 | data(opinion) 50 | data.table::setDT(opinion) 51 | expect_error(suppressMessages({ 52 | d_in = shape(opinion[female == "female"], 53 | item_names = "abortion", 54 | time_name = "year", 55 | geo_name = "state", 56 | group_names = "female", 57 | survey_name = "source", 58 | weight_name = "weight") 59 | }), "female doesn't vary in item_data") 60 | }) 61 | 62 | test_that("NAs in unused subsets of modifier_data are fine", { 63 | data(opinion) 64 | data(states) 65 | states[states$year == 2008, "income_percapita"] <- NA 66 | expect_silent(suppressMessages(shape(opinion, 67 | item_names = "abortion", 68 | time_name = "year", 69 | geo_name = "state", 70 | group_names = "female", 71 | modifier_data = states, 72 | modifier_names = "income_percapita", 73 | time_filter = 2009:2010, 74 | survey_name = "source", 75 | weight_name = "weight"))) 76 | }) 77 | 78 | test_that("NAs in restricted modifier_data produce an error", { 79 | data(opinion) 80 | data(states) 81 | states[states$year == 2008, "income_percapita"] <- NA 82 | expect_error(suppressMessages(shape(opinion, 83 | item_names = "abortion", 84 | time_name = "year", 85 | geo_name = "state", 86 | group_names = "female", 87 | modifier_data = states, 88 | modifier_names = "income_percapita", 89 | time_filter = 2008:2009, 90 | survey_name = "source", 91 | weight_name = "weight")), 92 | "NA values") 93 | }) 94 | 95 | test_that("omitting weight variable is allowed", { 96 | data(opinion) 97 | data(states) 98 | expect_silent(suppressMessages(shape(opinion, 99 | item_names = "abortion", 100 | time_name = "year", 101 | geo_name = "state", 102 | group_names = "female", 103 | modifier_data = states, 104 | modifier_names = "income_percapita", 105 | time_filter = 2008:2009, 106 | survey_name = "source"))) 107 | }) 108 | 109 | test_that("omitting survey variable is allowed", { 110 | data(opinion) 111 | data(states) 112 | expect_silent(suppressMessages(shape(opinion, 113 | item_names = "abortion", 114 | time_name = "year", 115 | geo_name = "state", 116 | group_names = "female", 117 | modifier_data = states, 118 | modifier_names = "income_percapita", 119 | time_filter = 2008:2009, 120 | weight_name = "weight"))) 121 | }) 122 | 123 | 124 | -------------------------------------------------------------------------------- /tests/testthat/test-item_coercion.R: -------------------------------------------------------------------------------- 1 | context("item coercion") 2 | 3 | test_that("item coercion works", { 4 | Ctrl <- setClass("Ctrl", slots = c("item_names")) 5 | ctrl <- new("Ctrl", item_names = "item") 6 | 7 | # 3-level character 8 | item_data <- setDT(data.frame("item" = letters[1:3], stringsAsFactors = FALSE)) 9 | expect_warning(result <- coerce_item_types(item_data, ctrl), "will be encoded") 10 | expect_length(result, 2) 11 | expect_equal(result[[1]], c(1, 0, 0)) 12 | expect_equal(result[[2]], c(0, 1, 0)) 13 | 14 | # 2-level character 15 | item_data <- setDT(data.frame("item" = letters[1:2], stringsAsFactors = FALSE)) 16 | expect_silent(result <- coerce_item_types(item_data, ctrl)) 17 | expect_length(result, 1) 18 | expect_equal(result[[1]], c(1, 0)) 19 | 20 | # 1-level character 21 | item_data <- setDT(data.frame("item" = "a", stringsAsFactors = FALSE)) 22 | expect_error(coerce_item_types(item_data, ctrl), "doesn't vary") 23 | 24 | # 3-level factor 25 | item_data <- setDT(data.frame("item" = letters[1:3])) 26 | expect_warning(result <- coerce_item_types(item_data, ctrl), "will be encoded") 27 | expect_length(result, 2) 28 | expect_equal(result[[1]], c(1, 0, 0)) 29 | expect_equal(result[[2]], c(0, 1, 0)) 30 | 31 | # 2-level factor 32 | item_data <- setDT(data.frame("item" = letters[1:2])) 33 | expect_silent(result <- coerce_item_types(item_data, ctrl)) 34 | expect_length(result, 1) 35 | expect_equal(result[[1]], c(1, 0)) 36 | 37 | # 1-level factor 38 | item_data <- setDT(data.frame("item" = "a")) 39 | expect_error(coerce_item_types(item_data, ctrl), "doesn't vary") 40 | 41 | # 3-level ordered 42 | item_data <- setDT(data.frame("item" = ordered(1:3))) 43 | expect_silent(result <- coerce_item_types(item_data, ctrl)) 44 | expect_length(result, 1) 45 | expect_equal(result[[1]], 1:3) 46 | 47 | # 2-level ordered 48 | item_data <- setDT(data.frame("item" = ordered(1:2))) 49 | expect_silent(result <- coerce_item_types(item_data, ctrl)) 50 | expect_length(result, 1) 51 | expect_equal(result[[1]], 1:2) 52 | 53 | # 1-level ordered 54 | item_data <- setDT(data.frame("item" = ordered(1))) 55 | expect_error(coerce_item_types(item_data, ctrl), "doesn't vary") 56 | expect_length(result, 1) 57 | expect_equal(result[[1]], 1:2) 58 | 59 | # 3-level numeric 60 | item_data <- setDT(data.frame("item" = 1:3)) 61 | expect_silent(result <- coerce_item_types(item_data, ctrl)) 62 | expect_length(result, 1) 63 | expect_equal(result[[1]], 1:3) 64 | }) 65 | -------------------------------------------------------------------------------- /tests/testthat/test-ns_vec.r: -------------------------------------------------------------------------------- 1 | context("n/s vectors") 2 | 3 | test_that("counts for minimal call haven't changed", { 4 | d_min <- shape(item_data = opinion, 5 | item_names = "abortion", 6 | time_name = "year", 7 | geo_name = "state", 8 | group_names = "female", 9 | survey_name = "source", 10 | weight_name = "weight") 11 | expect_equal_to_reference(d_min$n_vec, "d_min_n_vec.Rds") 12 | expect_equal_to_reference(d_min$s_vec, "d_min_s_vec.Rds") 13 | }) 14 | 15 | test_that("counts for call with aggregates haven't changed", { 16 | d_agg <- shape(aggregate_data = aggregates, 17 | item_data = opinion, 18 | item_names = "abortion", 19 | time_name = "year", 20 | geo_name = "state", 21 | group_names = c("female", "race3"), 22 | survey_name = "source", 23 | weight_name = "weight", 24 | time_filter = c(2006:2010), 25 | aggregate_item_names = "hlthcare_binary") 26 | expect_equal_to_reference(d_agg$n_vec, "d_agg_n_vec.Rds") 27 | expect_equal_to_reference(d_agg$s_vec, "d_agg_s_vec.Rds") 28 | }) 29 | 30 | test_that("unobserved groups are added to group counts", { 31 | d <- shape(item_data = opinion, 32 | time_filter = c(0, 2006), 33 | item_names = "abortion", 34 | time_name = "year", 35 | geo_name = "state", 36 | group_names = "female", 37 | survey_name = "source", 38 | weight_name = "weight") 39 | expect_equal(unique(d$group_counts$year), c(0, 2006)) 40 | }) 41 | 42 | test_that("n_vec and s_vec have expected order", { 43 | data(aggregates) 44 | data.table::setDT(aggregates) 45 | aggregates <- aggregates[, .(n_grp = sum(n_grp), s_grp = sum(s_grp)), by = 46 | c("year", "state", "female", "item")] 47 | d_agg <- shape(aggregate_data = aggregates, 48 | item_data = opinion, 49 | item_names = "abortion", 50 | modifier_data = states[states$year %in% 2006:2010, ], 51 | modifier_names = "prop_evangelicals", 52 | t1_modifier_names = "income_percapita", 53 | time_name = "year", 54 | geo_name = "state", 55 | group_names = c("female"), 56 | survey_name = "source", 57 | weight_name = "weight", 58 | time_filter = c(2006:2008), 59 | aggregate_item_names = "hlthcare_binary", 60 | standardize = TRUE) 61 | ctrl <- d_agg$control 62 | n_vec_names <- as.data.table(tstrsplit(names(d_agg$n_vec), "__")) 63 | colnames(n_vec_names) <- c(ctrl@time_name, ctrl@geo_name, ctrl@group_names, 64 | "item") 65 | n_vec_names[, year := type.convert(year)] 66 | 67 | # we loop over t, q, and g in that order; time should vary slowest 68 | t_order <- rep(ctrl@time_filter, each = d_agg$G * d_agg$Q) 69 | expect_equal(t_order, n_vec_names[[ctrl@time_name]]) 70 | 71 | # within each t iterate over q 72 | q_order <- rep(d_agg$gt_items, each = d_agg$G, times = d_agg$T) 73 | expect_equal(q_order, n_vec_names[["item"]]) 74 | 75 | # within each q iterate over g; group levels are the interaction of geo 76 | # levels and demographic levels, and geo varies fastest, iterated over for 77 | # each demographic level 78 | group_levels <- unique(c(d_agg$item_data[[ctrl@group_names]], 79 | d_agg$aggregate_data[[ctrl@group_names]])) 80 | geo_order <- rep(ctrl@geo_filter, times = d_agg$T * d_agg$Q * 81 | length(group_levels)) 82 | expect_equal(geo_order, n_vec_names[[ctrl@geo_name]]) 83 | g_order <- rep(group_levels, each = length(ctrl@geo_filter), 84 | times = d_agg$Q * d_agg$T) 85 | expect_equal(g_order, n_vec_names[[ctrl@group_names]]) 86 | }) 87 | 88 | -------------------------------------------------------------------------------- /tests/testthat/test-plot.r: -------------------------------------------------------------------------------- 1 | context("plots") 2 | 3 | test_that("dgirt_plot and plot can be called", { 4 | expect_silent(plot(toy_dgirtfit)) 5 | expect_silent(dgirt_plot(toy_dgirtfit)) 6 | }) 7 | 8 | 9 | test_that("plots can be amended", { 10 | expect_silent(dgirt_plot(toy_dgirtfit) %+% ylab("foo")) 11 | }) 12 | 13 | test_that("plot calls dgirt_plot", { 14 | p <- plot(toy_dgirtfit) 15 | dp <- dgirt_plot(toy_dgirtfit) 16 | expect_equal(p, dp) 17 | }) 18 | 19 | test_that("plot_rhats handles parameters", { 20 | expect_error(plot_rhats(toy_dgirtfit, pars = "xi", facet_vars = "state"), 21 | "not indexed by") 22 | expect_silent(plot_rhats(toy_dgirtfit, pars = "xi", color_var = "year")) 23 | }) 24 | 25 | test_that("pars must be a length-one character", { 26 | expect_error(plot_rhats(toy_dgirtfit, pars = NULL), "not a string") 27 | expect_error(plot_rhats(toy_dgirtfit, pars = c("xi", "sd_item")), 28 | "not a string") 29 | }) 30 | 31 | test_that("argument validation works", { 32 | estimates = as.data.frame(toy_dgirtfit) 33 | expect_silent(dgirt_plot(estimates, group_name = NULL, 34 | time_name = 'year', geo_name = 'state')) 35 | expect_error(dgirt_plot(estimates, group_name = NULL, 36 | time_name = c('year', 'race3'), geo_name = 'state'), "not a string") 37 | expect_silent(dgirt_plot(estimates, group_name = NULL, 38 | time_name = 'year', geo_name = 'state', y_fun = 'mean')) 39 | expect_error(dgirt_plot(estimates, group_name = NULL, 40 | time_name = 'year', geo_name = 'state', y_fun = mean), "not a string") 41 | expect_error(dgirt_plot(estimates, group_name = NULL, 42 | time_name = 'year', geo_name = 'state', y_fun = 'foo'), 43 | "could not find function") 44 | expect_error(dgirt_plot(estimates, group_name = NULL, 45 | time_name = 'year', geo_name = 'state', y_max = NULL), "should be too") 46 | expect_error(dgirt_plot(estimates, group_name = NULL, 47 | time_name = 'year', geo_name = 'state', y_min = NULL), "should be too") 48 | expect_error(dgirt_plot(estimates, group_name = NULL, 49 | time_name = 'year', geo_name = 'state', y_fun = NULL), "should be too") 50 | expect_silent(dgirt_plot(estimates, group_name = NULL, 51 | time_name = 'year', geo_name = 'state', y_min = NULL, y_max = NULL)) 52 | }) 53 | 54 | -------------------------------------------------------------------------------- /tests/testthat/test-varnames.r: -------------------------------------------------------------------------------- 1 | source("setup.r") 2 | 3 | d_min <- min_item_call() 4 | d_mod <- min_modifier_call() 5 | 6 | context("validation with valid_names") 7 | 8 | toy_table = data.frame(a = 1, b = 2) 9 | Ctrl <- setClass("Ctrl", slots = list("valid_name" = "character", 10 | "valid_names" = "character", "invalid_name" = "character", 11 | "invalid_names" = "character", "partial" = "character", 12 | "dupe_names" = "character", "missing_name" = "character", 13 | "null_name" = "character")) 14 | 15 | ctrl <- new("Ctrl", 16 | valid_name = "a", 17 | valid_names = c("a", "b"), 18 | invalid_name = "x", 19 | invalid_names = c("x", "y"), 20 | partial = c("a", "x"), 21 | dupe_names = c("a", "a"), 22 | missing_name = "", 23 | null_name = character(0)) 24 | 25 | test_that("valid_names works with an S4 and length requirement", { 26 | is_name <- dgo:::valid_names(toy_table, ctrl, 1) 27 | expect_silent(is_name("valid_name")) 28 | expect_error(is_name("valid_names"), ".*should be length 1, not 2.*") 29 | expect_error(is_name("invalid_name"), ".*should give a variable name in.*") 30 | expect_error(is_name("invalid_names"), ".*should be length 1, not 2.*") 31 | expect_error(is_name("partial"), ".*should be length 1, not 2.*") 32 | expect_error(is_name("dupe_names"), ".*should be length 1, not 2.*") 33 | expect_error(is_name("missing_name"), ".*should give a variable name in.*") 34 | expect_error(is_name("null_name"), ".*is required when using.*") 35 | }) 36 | 37 | test_that("valid_names works with an S4 and no length requirement", { 38 | are_names <- dgo:::valid_names(toy_table, ctrl) 39 | expect_silent(are_names("valid_name")) 40 | expect_silent(are_names("valid_names")) 41 | expect_error(are_names("invalid_name"), ".*should give variable names in.*") 42 | expect_error(are_names("invalid_names"), ".*should give variable names in.*") 43 | expect_error(are_names("partial"), ".*should give variable names in.*") 44 | expect_error(are_names("dupe_names"), ".*should give unique names") 45 | expect_error(are_names("missing_name"), ".*should give variable names in.*") 46 | expect_error(are_names("null_name"), ".*is required when using.*") 47 | }) 48 | 49 | test_that("valid_names works with plain character names and a length requirement", { 50 | toy_table = data.frame(a = 1, b = 2) 51 | is_name <- dgo:::valid_names(toy_table, NULL, 1) 52 | expect_silent(is_name("a")) 53 | expect_silent(is_name(c("a", "b"))) 54 | expect_error(is_name("z"), ".*should give a variable name in.*") 55 | expect_error(is_name(2), ".*should give a variable name in.*") 56 | }) 57 | 58 | test_that("valid_names works with plain character names and no length requirement", { 59 | are_names <- dgo:::valid_names(toy_table, NULL, 0) 60 | expect_silent(are_names(c("a", "b"))) 61 | expect_error(are_names(c("a", "z")), ".*should give variable names in.*") 62 | }) 63 | 64 | context("required arguments for modifier_data") 65 | 66 | test_that("either modifier_names or t1_modifier_names is required", { 67 | expect_silent(suppressMessages(shape(opinion, 68 | modifier_data = states, 69 | t1_modifier_names = "prop_evangelicals", 70 | item_names = "abortion", 71 | time_name = "year", 72 | geo_name = "state", 73 | group_names = "female"))) 74 | expect_silent(suppressMessages(shape(opinion, 75 | modifier_data = states, 76 | modifier_names = "prop_evangelicals", 77 | item_names = "abortion", 78 | time_name = "year", 79 | geo_name = "state", 80 | group_names = "female"))) 81 | expect_error(suppressMessages(shape(opinion, 82 | modifier_data = states, 83 | item_names = "abortion", 84 | time_name = "year", 85 | geo_name = "state", 86 | group_names = "female")), 87 | paste("Either \"modifier_names\" or \"t1_modifier_names\" is required", 88 | "when using modifier data")) 89 | }) 90 | 91 | context("required arguments for target_data") 92 | 93 | expect_error(shape(opinion, 94 | target_data = targets, 95 | proportion_name = "proportion", 96 | item_names = "abortion", 97 | time_name = "year", 98 | geo_name = "state", 99 | group_names = "female", 100 | survey_name = "source", 101 | weight_name = "weight"), 102 | "raking.*required when using.*target_data") 103 | -------------------------------------------------------------------------------- /tests/testthat/test-zz.r: -------------------------------------------------------------------------------- 1 | source("setup.r") 2 | 3 | d_min <- min_item_call() 4 | d_mod <- min_modifier_call(standardize = FALSE) 5 | data(states) 6 | data.table::setDT(states) 7 | states = states[year %in% 2006:2010] 8 | 9 | context("hierarchical parameter names") 10 | 11 | hier_names <- c(sort(unique(states$state))[-1], "femalemale") 12 | 13 | test_that('hier_name and ZZ dimnames match', { 14 | expect_identical(hier_names, d_mod$hier_names) 15 | expect_identical(hier_names, dimnames(d_mod$ZZ)[[2]]) 16 | expect_identical(dimnames(d_mod$ZZ)[[3]], "prop_evangelicals") 17 | expect_identical(dimnames(d_mod$ZZ_prior)[[3]], "prop_evangelicals") 18 | }) 19 | 20 | context("hierarchical parameter counts") 21 | 22 | test_that('hier_names is a P-vector', { 23 | expect_identical(length(hier_names), d_mod$P) 24 | }) 25 | 26 | test_that('S is the count of geographic units - 1', { 27 | geo_observed <- length(unique(d_min$group_grid_t$state)) 28 | expect_identical(d_min$S, geo_observed - 1) 29 | }) 30 | 31 | context("hierarchical modifier is numeric") 32 | 33 | test_that('values in ZZ are also numeric', { 34 | expect_true(is.numeric(d_mod$ZZ)) 35 | }) 36 | 37 | test_that('modifier values appear in the correct rows of ZZ', { 38 | zz <- reshape2::acast(states[, .(year, state, prop_evangelicals)], 39 | year ~ state ~ "prop_evangelicals", 40 | value.var = 'prop_evangelicals', drop = FALSE) 41 | # omit first hierarchical parameter 42 | zz <- zz[, -1L, , drop = FALSE] 43 | expect_identical(zz, d_mod$ZZ[, -dim(d_mod$ZZ)[2], , drop = FALSE]) 44 | }) 45 | 46 | test_that('elements in ZZ corresponding to the grouping variable are zeroed', { 47 | expect_identical(d_mod$ZZ[, length(hier_names), 1L], 48 | setNames(rep(0, length(unique(states$year))), unique(states$year))) 49 | }) 50 | 51 | context("hierarchical modifier is character") 52 | 53 | test_that('character values of modifier are dummied', { 54 | # in legacy code, gave this error: Error in shape_hierarchical_data(level2, 55 | # level2_modifiers, group_grid_t, : non-numeric values in hierarchical data. 56 | # Factor handling probably failed. Possible quick fix: omit or manually dummy 57 | # out any factors in 'level2_modifiers' or 'level2_period1_modif iers'. 58 | expect_error(min_modifier_call(modifier_names = "region", 59 | t1_modifier_names = "region"), 60 | "should be one of: integer, numeric") 61 | }) 62 | 63 | test_that('elements in ZZ corresponding to the grouping variable are zeroed', { 64 | expect_identical(d_mod$ZZ[, length(hier_names), 1L], 65 | setNames(rep(0, length(unique(states$year))), unique(states$year))) 66 | }) 67 | 68 | context("hierarchical modifier variable is factor") 69 | 70 | test_that('factor values of modifier are dummied', { 71 | states$region <- as.factor(states$region) 72 | expect_error(min_modifier_call(modifier_names = "region", 73 | t1_modifier_names = "region"), 74 | "should be one of: integer, numeric") 75 | }) 76 | 77 | test_that('ZZ is zeroed appropriately when only t1_modifier_names is given', { 78 | 79 | d_t1_only <- shape(item_data = opinion, 80 | item_names = "abortion", 81 | time_name = "year", 82 | geo_name = "state", 83 | group_names = "female", 84 | modifier_data = states, 85 | t1_modifier_names = "prop_evangelicals") 86 | expect_true(all(d_t1_only$ZZ == 0)) 87 | expect_identical(hier_names, d_t1_only$hier_names) 88 | expect_identical(hier_names, dimnames(d_t1_only$ZZ)[[2]]) 89 | expect_identical(dimnames(d_t1_only$ZZ)[[3]], "") 90 | }) 91 | 92 | test_that('ZZ_prior defaults to ZZ', { 93 | 94 | d_tprime_only <- shape(item_data = opinion, 95 | item_names = "abortion", 96 | time_name = "year", 97 | geo_name = "state", 98 | group_names = "female", 99 | modifier_data = states, 100 | modifier_names = "prop_evangelicals") 101 | expect_identical(d_tprime_only$ZZ_prior, d_tprime_only$ZZ) 102 | expect_identical(hier_names, d_tprime_only$hier_names) 103 | expect_identical(hier_names, dimnames(d_tprime_only$ZZ_prior)[[2]]) 104 | }) 105 | 106 | test_that("order of ZZ and XX columns is consistent when vector of group_names is unsorted and geographic data is used", { 107 | expect_silent(suppressMessages(shape(item_data = opinion, 108 | item_names = "affirmative_action", 109 | weight_name = "weight", 110 | time_name = "year", 111 | geo_name = "state", 112 | group_names = c("female", "education"), 113 | modifier_data = states, 114 | modifier_names = 'prop_hispanic', 115 | id_vars = "source"))) 116 | }) 117 | 118 | -------------------------------------------------------------------------------- /tools/example_objects.R: -------------------------------------------------------------------------------- 1 | devtools::load_all() 2 | data(opinion) 3 | toy_dgirt_in <- shape(opinion, 4 | time_name = "year", 5 | item_names = c("affirmative_action", "gaymarriage_amendment"), 6 | geo_name = "state", 7 | group_names = "race3", 8 | survey_name = "source", 9 | geo_filter = c("VA", "SC"), 10 | time_filter = 2009:2010, 11 | weight_name = "weight") 12 | devtools::use_data(toy_dgirt_in, overwrite = TRUE) 13 | 14 | toy_dgirtfit <- dgirt(toy_dgirt_in, iter = 400, chains = 4, cores = 4) 15 | devtools::use_data(toy_dgirtfit, overwrite = TRUE) 16 | -------------------------------------------------------------------------------- /tools/test_objects.R: -------------------------------------------------------------------------------- 1 | devtools::load_all() 2 | data(toy_dgirt_in) 3 | data(toy_dgirtfit) 4 | data(opinion) 5 | 6 | dgirt_ret <- dgirt(toy_dgirt_in, iter = 5, chains = 1, seed = 42, 7 | model = toy_dgirtfit@stanmodel) 8 | saveRDS(dgirt_ret, "tests/testthat/dgirt_ret.Rds") 9 | 10 | dgmrp_in <- shape(opinion, item_names = "abortion", time_name = "year", 11 | geo_name = "state", group_names = "race3", geo_filter = c("CA", "GA")) 12 | 13 | dgmrp_ret <- dgmrp(dgmrp_in, iter = 5, chains = 1, seed = 42, 14 | model = toy_dgirtfit@stanmodel) 15 | saveRDS(dgmrp_ret, "tests/testthat/dgmrp_ret.Rds") 16 | -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/__packages: -------------------------------------------------------------------------------- 1 | base 2 | dgodata 3 | ggplot2 4 | StanHeaders 5 | rstan 6 | dgo 7 | -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/dgmrp_plot_d3024781d005ada7e8281178d61d6a61.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/dgmrp_plot_d3024781d005ada7e8281178d61d6a61.RData -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/dgmrp_plot_d3024781d005ada7e8281178d61d6a61.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/dgmrp_plot_d3024781d005ada7e8281178d61d6a61.rdb -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/dgmrp_plot_d3024781d005ada7e8281178d61d6a61.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/dgmrp_plot_d3024781d005ada7e8281178d61d6a61.rdx -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/dgmrp_plot_ps_511a1c935b490935f82473064f919a9f.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/dgmrp_plot_ps_511a1c935b490935f82473064f919a9f.RData -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/dgmrp_plot_ps_511a1c935b490935f82473064f919a9f.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/dgmrp_plot_ps_511a1c935b490935f82473064f919a9f.rdb -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/dgmrp_plot_ps_511a1c935b490935f82473064f919a9f.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/dgmrp_plot_ps_511a1c935b490935f82473064f919a9f.rdx -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-1_1b54e2e0ef1fdbb838541bfdc6f8f170.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-1_1b54e2e0ef1fdbb838541bfdc6f8f170.RData -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-1_1b54e2e0ef1fdbb838541bfdc6f8f170.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-1_1b54e2e0ef1fdbb838541bfdc6f8f170.rdb -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-1_1b54e2e0ef1fdbb838541bfdc6f8f170.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-1_1b54e2e0ef1fdbb838541bfdc6f8f170.rdx -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-2_174a87eca0b3c0bb0a1585ea74cfc6be.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-2_174a87eca0b3c0bb0a1585ea74cfc6be.RData -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-2_174a87eca0b3c0bb0a1585ea74cfc6be.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-2_174a87eca0b3c0bb0a1585ea74cfc6be.rdb -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-2_174a87eca0b3c0bb0a1585ea74cfc6be.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-2_174a87eca0b3c0bb0a1585ea74cfc6be.rdx -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-3_2f2dc23d9b65cc7cd7d679384aa8b06b.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-3_2f2dc23d9b65cc7cd7d679384aa8b06b.RData -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-3_2f2dc23d9b65cc7cd7d679384aa8b06b.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-3_2f2dc23d9b65cc7cd7d679384aa8b06b.rdb -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-3_2f2dc23d9b65cc7cd7d679384aa8b06b.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-3_2f2dc23d9b65cc7cd7d679384aa8b06b.rdx -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-4_52ab4fd35d38a304cb265918d704060f.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-4_52ab4fd35d38a304cb265918d704060f.RData -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-4_52ab4fd35d38a304cb265918d704060f.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-4_52ab4fd35d38a304cb265918d704060f.rdb -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-4_52ab4fd35d38a304cb265918d704060f.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-4_52ab4fd35d38a304cb265918d704060f.rdx -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-5_fc906da652962bd2049d905b371c9761.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-5_fc906da652962bd2049d905b371c9761.RData -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-5_fc906da652962bd2049d905b371c9761.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-5_fc906da652962bd2049d905b371c9761.rdb -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-5_fc906da652962bd2049d905b371c9761.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-5_fc906da652962bd2049d905b371c9761.rdx -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-6_16ef36c67b636e48629cd8e0ece84a75.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-6_16ef36c67b636e48629cd8e0ece84a75.RData -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-6_16ef36c67b636e48629cd8e0ece84a75.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-6_16ef36c67b636e48629cd8e0ece84a75.rdb -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-6_16ef36c67b636e48629cd8e0ece84a75.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-6_16ef36c67b636e48629cd8e0ece84a75.rdx -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-7_4d12c28894575a3a1d9d9f0867c9da45.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-7_4d12c28894575a3a1d9d9f0867c9da45.RData -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-7_4d12c28894575a3a1d9d9f0867c9da45.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-7_4d12c28894575a3a1d9d9f0867c9da45.rdb -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-7_4d12c28894575a3a1d9d9f0867c9da45.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-7_4d12c28894575a3a1d9d9f0867c9da45.rdx -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-8_3b137cfdaf9edf395e4237e734c04e1b.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-8_3b137cfdaf9edf395e4237e734c04e1b.RData -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-8_3b137cfdaf9edf395e4237e734c04e1b.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-8_3b137cfdaf9edf395e4237e734c04e1b.rdb -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-8_3b137cfdaf9edf395e4237e734c04e1b.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-8_3b137cfdaf9edf395e4237e734c04e1b.rdx -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-9_70cca80e7b4dc91963e597745772228e.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-9_70cca80e7b4dc91963e597745772228e.RData -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-9_70cca80e7b4dc91963e597745772228e.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-9_70cca80e7b4dc91963e597745772228e.rdb -------------------------------------------------------------------------------- /vignettes/abortion_attitudes_cache/html/unnamed-chunk-9_70cca80e7b4dc91963e597745772228e.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/abortion_attitudes_cache/html/unnamed-chunk-9_70cca80e7b4dc91963e597745772228e.rdx -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/__packages: -------------------------------------------------------------------------------- 1 | base 2 | dgodata 3 | ggplot2 4 | StanHeaders 5 | rstan 6 | dgo 7 | -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/dgirt_plot_b4fa5eae7ac78a096972b07acb34f1f5.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/dgirt_plot_b4fa5eae7ac78a096972b07acb34f1f5.RData -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/dgirt_plot_b4fa5eae7ac78a096972b07acb34f1f5.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/dgirt_plot_b4fa5eae7ac78a096972b07acb34f1f5.rdb -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/dgirt_plot_b4fa5eae7ac78a096972b07acb34f1f5.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/dgirt_plot_b4fa5eae7ac78a096972b07acb34f1f5.rdx -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/dgirt_plot_ps_e677377f0eecb9170d1d44ae8ae519b7.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/dgirt_plot_ps_e677377f0eecb9170d1d44ae8ae519b7.RData -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/dgirt_plot_ps_e677377f0eecb9170d1d44ae8ae519b7.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/dgirt_plot_ps_e677377f0eecb9170d1d44ae8ae519b7.rdb -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/dgirt_plot_ps_e677377f0eecb9170d1d44ae8ae519b7.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/dgirt_plot_ps_e677377f0eecb9170d1d44ae8ae519b7.rdx -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-1_556f792b879b73520d1579b54f883f36.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-1_556f792b879b73520d1579b54f883f36.RData -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-1_556f792b879b73520d1579b54f883f36.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-1_556f792b879b73520d1579b54f883f36.rdb -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-1_556f792b879b73520d1579b54f883f36.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-1_556f792b879b73520d1579b54f883f36.rdx -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-2_9d7055b643b182a7faa7312f609d403c.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-2_9d7055b643b182a7faa7312f609d403c.RData -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-2_9d7055b643b182a7faa7312f609d403c.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-2_9d7055b643b182a7faa7312f609d403c.rdb -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-2_9d7055b643b182a7faa7312f609d403c.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-2_9d7055b643b182a7faa7312f609d403c.rdx -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-3_ecef3683b1a3cb87e32babeb21b827b0.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-3_ecef3683b1a3cb87e32babeb21b827b0.RData -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-3_ecef3683b1a3cb87e32babeb21b827b0.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-3_ecef3683b1a3cb87e32babeb21b827b0.rdb -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-3_ecef3683b1a3cb87e32babeb21b827b0.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-3_ecef3683b1a3cb87e32babeb21b827b0.rdx -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-4_f98071591ab4f9cc37793edfc38d0660.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-4_f98071591ab4f9cc37793edfc38d0660.RData -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-4_f98071591ab4f9cc37793edfc38d0660.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-4_f98071591ab4f9cc37793edfc38d0660.rdb -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-4_f98071591ab4f9cc37793edfc38d0660.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-4_f98071591ab4f9cc37793edfc38d0660.rdx -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-5_7a37ae57bb5125deaa756983c299cd51.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-5_7a37ae57bb5125deaa756983c299cd51.RData -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-5_7a37ae57bb5125deaa756983c299cd51.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-5_7a37ae57bb5125deaa756983c299cd51.rdb -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-5_7a37ae57bb5125deaa756983c299cd51.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-5_7a37ae57bb5125deaa756983c299cd51.rdx -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-6_d654b70fc50aa8a6a560b061c4a6ec58.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-6_d654b70fc50aa8a6a560b061c4a6ec58.RData -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-6_d654b70fc50aa8a6a560b061c4a6ec58.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-6_d654b70fc50aa8a6a560b061c4a6ec58.rdb -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-6_d654b70fc50aa8a6a560b061c4a6ec58.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-6_d654b70fc50aa8a6a560b061c4a6ec58.rdx -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-7_6f9dfb97b6fc0536dc167992916642a9.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-7_6f9dfb97b6fc0536dc167992916642a9.RData -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-7_6f9dfb97b6fc0536dc167992916642a9.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-7_6f9dfb97b6fc0536dc167992916642a9.rdb -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-7_6f9dfb97b6fc0536dc167992916642a9.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-7_6f9dfb97b6fc0536dc167992916642a9.rdx -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-8_d0e24fb7bb62e382ff8edfda5f69614d.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-8_d0e24fb7bb62e382ff8edfda5f69614d.RData -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-8_d0e24fb7bb62e382ff8edfda5f69614d.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-8_d0e24fb7bb62e382ff8edfda5f69614d.rdb -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-8_d0e24fb7bb62e382ff8edfda5f69614d.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-8_d0e24fb7bb62e382ff8edfda5f69614d.rdx -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-9_8d21b4c4bd700275410cd61340d5c688.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-9_8d21b4c4bd700275410cd61340d5c688.RData -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-9_8d21b4c4bd700275410cd61340d5c688.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-9_8d21b4c4bd700275410cd61340d5c688.rdb -------------------------------------------------------------------------------- /vignettes/policy_liberalism_cache/html/unnamed-chunk-9_8d21b4c4bd700275410cd61340d5c688.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesdunham/dgo/2961b5b99c27c59f1889ee8cb90c5b30ad223d9c/vignettes/policy_liberalism_cache/html/unnamed-chunk-9_8d21b4c4bd700275410cd61340d5c688.rdx --------------------------------------------------------------------------------