Publications by Corey Sparks, PhD
Tidycensus basic setup and use
This example will show you how to setup the tidycensus package in R citation(package = "tidycensus") ## ## To cite package 'tidycensus' in publications use: ## ## Kyle Walker (2020). tidycensus: Load US Census Boundary and Attribute ## Data as 'tidyverse' and 'sf'-Ready Data Frames. R package version ## 0.9.5. https://CRAN.R-project.org/p...
1164 sym R (937 sym/4 pcs) 1 img
DEM 7283 - Example 2 - Logit and Probit Models
Categorical outcomes In the vast majority of situations in your work as demographers, your outcome will either be of a qualitative nature or non-normally distributed, especially if you work with individual level survey data. When we speak of qualitative outcomes, we generally are concerned with the observation of: A particular behavior (marriage...
10484 sym R (17857 sym/83 pcs) 5 img 4 tbl
DEM 7093 Lab 1 exercise
Get a Census developer API Key Obtain one at http://api.census.gov/data/key_signup.html Save your API key to your working directory use tidycensus::census_api_key(key = "yourkeyhere", install = T) one time to install your key for use in tidycensus library(tidycensus) library(tidyverse) library(sf) library(ggplot2) v15_Profile <- load_variables(...
931 sym R (4242 sym/15 pcs) 3 img
DEM 7283 - Example 1 - Survey Statistics using BRFSS data
What is a survey? A systematic method for gathering information from a sample of entities for the purposes of constructing quantitative descriptors of the attributes of the larger population of which the entities are members Questions when identifying a survey data source: What is the target population? What is the sampling frame how do we kno...
11498 sym R (14471 sym/69 pcs) 3 img 6 tbl
DEM 7223 - Event History Analysis - Example of Multi-state event history analysis
This example will illustrate how to fit a multistate hazard model using the multinomial logit model. The outcome for the example is whether a family experiences a transition between poverty states between waves 1 and 5 of the data. The data from the ECLS-K. #Load required libraries library(survival) library(car) ## Loading required package: car...
1198 sym R (13530 sym/34 pcs) 3 img 1 tbl
DEM 5093/7093 Lab 2 using R - Map projections and transformations
This lab complements the exercise using Qgis for today Here, we use tidycensus to read some tract data, learn its projection information, transform it to a new coordinate system and measure some distance between features. library(tidycensus) library(sf) ## Linking to GEOS 3.6.1, GDAL 2.2.3, PROJ 4.9.3 library(dplyr) ## ## Attaching package: 'd...
373 sym R (2307 sym/21 pcs) 2 img
DEM 7283 - Example 2 - Logit and Probit Models
Categorical outcomes In the vast majority of situations in your work as demographers, your outcome will either be of a qualitative nature or non-normally distributed, especially if you work with individual level survey data. When we speak of qualitative outcomes, we generally are concerned with the observation of: A particular behavior (marriage...
12263 sym R (15013 sym/73 pcs) 2 img 5 tbl
DEM 7283 - Logistic Regression - Other Topics
In this example, we continue the discussion of the logistic regression model from last week. This week we examine model nesting and stratification. We also look at using the logistic regression model for a binary classification model, commonly used in machine learning. #load libraries library(car) ## Loading required package: carData library(star...
8130 sym R (20479 sym/92 pcs) 7 img 3 tbl
DEM 7093 More fun with vector analysis
In this example I will use QGIS geoprocessing scripts through the RQGIS library in R. I will use data from the 2005 Peru Demographic and Health Survey, where I construct Voronoi polygons from the primary sampling unit locations and generate estimates of educational attainment for women. library(sf) ## Linking to GEOS 3.6.1, GDAL 2.2.3, PROJ 4.9.3...
2585 sym R (11675 sym/81 pcs) 2 img
DEM 7283 Count data regression for survey and aggregate data
This example will cover the use of R functions for fitting count data models to complex survey data and to aggregate data at the county level. Specifically, we focus on the Poisson and Negative Binomial models to individual level survey data as well as for aggregate data. For this example I am using 2016 CDC Behavioral Risk Factor Surveillance Sy...
23799 sym R (29027 sym/93 pcs) 6 img