Loved by learners at thousands of companies
This is an introductory course to the R programming language as applied in the context of political data analysis. In this course students learn how to wrangle, visualize, and model data with R by applying data science techniques to real-world political data such as public opinion polling and election results. The tools that you'll use in this course, from the dplyr, ggplot2, and choroplethr packages, among others, are staples of data science and can be used to analyze almost any dataset you get your hands on. Students will learn how to mutate columns and filter datasets, graph points and lines on charts, make maps, and create models to understand relationships between variables and predict the future. This course is suitable for anyone who already has downloaded R and knows the basics, like how to install packages.
Presidential Job Approval PollsFree
Chapter one uses a dataset of job approval polling for US presidents since Harry Truman to introduce you to data wrangling and visualization in the tidyverse.Introduction50 xpSelecting columns of data100 xpFiltering rows of data100 xpAveraging job approval by president50 xpAveraging approval ratings by president100 xpAveraging a column100 xpVisualizing Trump's approval over time50 xpAveraging president Trump's approval by month100 xpCalculating a rolling average of polls100 xpVisualizing Donald Trump's approval polls100 xpBonus: Visualizing every president's approval100 xp
U.S. House and Senate Polling
In this chapter, you will embark on a historical analysis of "generic ballot" US House polling and use data visualization and modeling to answer two big questions: Has the country changed over time? Can polls predict elections?Elections and political parties50 xpTidyverse refresher50 xpMeasuring support for U.S. political parties100 xpMutating a new column100 xp73 Years of "generic ballot" polls50 xpComparing the Democratic lead by year100 xpA time series of House and Senate polling100 xpVisualizing a time series100 xpGraphing trend lines with geom_smooth()100 xpCalculating and visualizing error in polls50 xpCalculating error in polls100 xpConfidence intervals100 xpGeom_point() and geom_errorbar()100 xpPredicting winners with linear regression50 xpFitting a model to past polls and results100 xpMaking a prediction on new data100 xp
Election Results and Political Demography
This chapter teaches you how to make maps and understand linear regression in R. With election results from the United States and the United Kingdom, you'll also learn how to use regression models to analyze the relationship between two (or more!) variables.The 2016 US presidential election50 xpCounty-level election results and spread()100 xpCounty-level demographic data and left_join()100 xpMerging demographic and voting data100 xpAnalyzing votes and demographic data100 xpMaking county-level maps in R50 xpMapping the Democratic vote by county100 xpMapping the concentration of white Americans100 xpAnalyzing results with linear regression50 xpAnswering "why" questions for elections100 xpMultivariate regression in R100 xpThe 2016 UK referendum to leave the EU (Brexit)50 xpWho was "supposed" to win?100 xpBrexit results100 xpUKIP and Brexit100 xpThe "why" question for Brexit100 xp
Predicting the Future of Politics
In this ensemble of applied statistics and data analysis, you will wrangle, visualize, and model polling and prediction data for two sets of very important US elections: the 2018 House midterms and 2020 presidential election.The House of Representatives in 201850 xpThe "generic ballot" in 2018100 xpPolls in August and September100 xpTraining a model to predict the future with polls50 xpTraining a model100 xpPredictions on new data100 xpUncertainty50 xpThe presidency in 202050 xpA model for presidential elections100 xpTraining the model100 xpPredicting 2020 with the model100 xpCourse recap50 xp
PrerequisitesIntroduction to the Tidyverse
G Elliott Morris
Elliott Morris is a data journalist who uses applied statistics and data science techniques with R to analyze, visualize, and model political (and other) data. Before he wrote articles and code professionally, he studied government, history, and computer science at the University of Texas at Austin. He shares his work frequently on Twitter (@gelliottmorris) and writes about data in politics at his blog, The Crosstab.