Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
^R/ei_sim\.R$
^CODE_OF_CONDUCT\.md$
^CONTRIBUTING\.md$
^cran-comments\.md$
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ importFrom(stats,na.omit)
importFrom(stats,quantile)
importFrom(stats,sd)
importFrom(stats,setNames)
importFrom(stats,weighted.mean)
importFrom(stringr,str_c)
importFrom(stringr,str_count)
importFrom(stringr,str_detect)
Expand Down
39 changes: 0 additions & 39 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,45 +65,6 @@
#' @source East Ramapo School District
"ersd_maps"


#' Los Angeles County 2010 Election Results
#'
#' This dataset contains precinct vote data and racial demographics from a 2010
#' election in Los Angeles County.
#'
#' @name lac_10
#' @format A data frame with 4980 observations on the following 10 variables:
#' \describe{
#' \item{precinct}{Precinct ID number.}
#' \item{tot_reg}{The total number of registered voters.}
#' \item{i_jones}{Number of votes for Jones.}
#' \item{i_delatore}{Number of votes for Delatorre.}
#' \item{votescast}{The total number of votes cast.}
#' \item{lat_voters}{Number of Latino voters.}
#' \item{pct_latino}{Percent of voters identifying as Latino.}
#' \item{pct_delatorre}{Percent of vote for Delatorre.}
#' \item{pct_jones}{Percent of vote for Jones.}
#' \item{pct_other}{Percent of vote for other candidates.}
#' }
#' @usage data(lac_10)
#' @source Los Angeles County
"lac_10"


#' New York State FIPS codes
#'
#' New York State FIPS codes for 500 voters.
#'
#' @name ny_fips
#' @format A data frame with 500 observations on the following 2 variables:
#' \describe{
#' \item{row_id}{Unique identifier.}
#' \item{FIP}{The 15-digit FIPS code.}
#' }
#' @usage data(ny_fips)
"ny_fips"


#' New York Voter File Sample
#'
#' This dataset contains a sample of 500 voters in East Ramapo School District,
Expand Down
3 changes: 2 additions & 1 deletion R/ei_homog.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
#' @param race_cols A character vector listing the column names for turnout by race
#' @param totals_col The name of the column containing total votes cast in each precinct
#' @param cp numeric; homogeneous precinct cut-point, e.g., 0.80; default = 0.80
#' @warn_row = numeric; threshold number of precincts racial group must be above to
#' @param warn_row numeric; threshold number of precincts racial group must be above to
#' conduct analysis; default = 5. For example, with three groups, whites, blacks, Hispanics,
#' each group must have at least 5 precincts with at least 80% share of the population for
#' that group. All racial groups need to have at least n number of precincts at or above
#' warn_row level or error will be thrown.
#' @param verbose flag indicating whether to print status messages
#' @return matrix with homogeneous precinct results, columns = race groups, rows = candidates
#' @author Loren Collingwood <loren.collingwood@@ucr.edu>; <loren.collingwood@@gmail.com>
#' @author Stephen Popick
Expand Down
2 changes: 1 addition & 1 deletion R/map_interactive.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ map_interactive <- function(voter_file,
}


map_inter <- leaflet(data = voter_file) %>%
map_inter <- leaflet::leaflet(data = voter_file) %>%
addTiles() %>%
addMarkers(~lat, ~lon,
popup = paste(
Expand Down
18 changes: 18 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## R CMD check results

## Test environments
* local OS X install, R 4.0.2
* ubuntu 18.04 (on travis-ci), R 4.0.2

## R CMD check results
There were no ERRORs or WARNINGs.

There were 2 NOTES:

* NOTE installed size is 5.7Mb sub-directories of 1Mb or more: doc 4.7Mb

As described in the .readme, the package is built to facilitate work by users with many different levels of programming experience. This requires detailed, extensive documentation.

* checking for future file timestamps ... NOTE unable to verify current time

As indicated [here](https://stackoverflow.com/questions/63613301/r-cmd-check-note-unable-to-verify-current-time) this appears to be an issue within `r-cmd-check`
Binary file removed data/lac_10.rda
Binary file not shown.
Binary file removed data/ny_fips.rda
Binary file not shown.
6 changes: 3 additions & 3 deletions man/ei_homog.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 0 additions & 32 deletions man/lac_10.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/ny_fips.Rd

This file was deleted.

Binary file removed vignettes/fulton_gwinnett_shape_maps.PNG
Binary file not shown.
Binary file removed vignettes/gelman.png
Binary file not shown.
Binary file removed vignettes/geo_combined_map_interactive_small.PNG
Binary file not shown.
Binary file removed vignettes/geo_combined_map_points_voters.PNG
Binary file not shown.
11 changes: 3 additions & 8 deletions vignettes/geocoding.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Each library/package loaded allows you to use certain functions needed to prep y
```{r setup, results='hide', message=FALSE}
library(eiCompare)
library(stringr)
library(plyr)
library(dplyr)
library(tidyr)
library(foreach)
Expand Down Expand Up @@ -145,10 +144,6 @@ voter_data <- concat_final_address(
voter_data <- as_tibble(voter_data)
```

```{r, echo=FALSE}
knitr::include_graphics("voter_data_df.PNG")
```

### <u>Step 3: run_geocoder() Function</u>

#### <b>Select a geocoder and run the geocoder on the addresses in your file.</b>
Expand Down Expand Up @@ -335,7 +330,7 @@ We will map the area or ecological unit we are interested in using the tigris pa
```

```{r, echo=FALSE}
knitr::include_graphics("fulton_gwinnett_shape_maps.PNG")
# knitr::include_graphics("fulton_gwinnett_shape_maps.PNG")
```

We now will look at the block level of Fulton and Gwinnett county.
Expand All @@ -362,7 +357,7 @@ We now will look at the block level of Fulton and Gwinnett county.
```

```{r, echo=FALSE}
knitr::include_graphics("geo_combined_map_points_voters.PNG")
# knitr::include_graphics("geo_combined_map_points_voters_compressed.png")
```

```{r}
Expand All @@ -378,5 +373,5 @@ knitr::include_graphics("geo_combined_map_points_voters.PNG")
```

```{r, echo=FALSE}
knitr::include_graphics("geo_combined_map_interactive_small.PNG")
# knitr::include_graphics("geo_combined_map_interactive_small_compressed.png")
```
Binary file removed vignettes/para_benchmark_box_nsamples.png
Binary file not shown.
2 changes: 1 addition & 1 deletion vignettes/parallel_processing.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Depending on your dataset, the number of races and candidates you're analyzung,

```{r echo=FALSE, out.width='100%'}

knitr::include_graphics("para_benchmark_box_nsamples.png")
# knitr::include_graphics("para_benchmark_box_nsamples.png")
```

## Summary
Expand Down
Binary file removed vignettes/trace_density.png
Binary file not shown.
12 changes: 6 additions & 6 deletions vignettes/visualizations.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Let's look at the tomography plot for the Candidate for the Hispanic demographic

```{r echo=FALSE, out.width='100%'}

knitr::include_graphics("tomography_pct_montanez_pct_hisp.png")
# knitr::include_graphics("tomography_pct_montanez_pct_hisp.png")
```


Expand All @@ -123,7 +123,7 @@ These plots can be used to confirm this point estimate distributions for $\beta^

```{r echo=FALSE, out.width='100%'}

knitr::include_graphics("density_pct_montanez_pct_hisp.png")
# knitr::include_graphics("density_pct_montanez_pct_hisp.png")
```

### Density voter choice comparison plots for each race
Expand All @@ -132,7 +132,7 @@ This overlaid density plot answers the question "How do voters from a certain ra

```{r echo=FALSE, out.width='100%'}

knitr::include_graphics("pct_husted_pct_button_asian.png")
# knitr::include_graphics("pct_husted_pct_button_asian.png")
```


Expand All @@ -143,7 +143,7 @@ Racially polarized voting by taking the difference of the posterior distribution

```{r echo=FALSE, out.width='100%'}

knitr::include_graphics("rpv_density.png")
# knitr::include_graphics("rpv_density.png")
```


Expand All @@ -168,15 +168,15 @@ The `coda` package enables creating trace and density plots, side-by-side for ea


```{r echo=FALSE, out.width='0.75\\linewidth'}
knitr::include_graphics("trace_density.png")
# knitr::include_graphics("trace_density.png")
```


### Gelman-Rubin diagnostic plot
The Gelman-Rubin diagnostic is one method to test for convergence to see if the sample is close to the posterior distribution. You'll get one plot for each parameter and produces the scale reduction factor. In these plots you'll be looking to for values below a factor of ~1.1 so these plots will give you a good sense of any changes you'll need for burn-in.

```{r echo=FALSE, out.width='0.75\\linewidth'}
knitr::include_graphics("gelman.png")
# knitr::include_graphics("gelman.png")
```


Expand Down
Binary file removed vignettes/voter_data_df.PNG
Binary file not shown.