This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(haven) | |
# Get data from https://www.chesdata.eu/ches-europe | |
## Look for: Special Edition Chapel Hill Expert Surveys (SPEED CHES) - 2023 SPEED CHES - Ukraine | |
uk <- read_dta("CHES_Ukraine_Feb2024.dta") | |
# Or run: | |
# uk <- read_csv("https://raw.githubusercontent.com/zilinskyjan/code-and-data/master/politics/CHES_Ukraine_Feb2024.csv") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Get data from: https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi%3A10.7910/DVN/PR4L8P | |
use "CCES22_Common_OUTPUT_vv_topost.dta", clear | |
* net install cibar, from("http://fmwww.bc.edu/RePEc/bocode/c") replace | |
* ssc install schemepack, replace | |
gen age = 2022-birthyr | |
* Keeping the main categories (99.27% of observations) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_pal <- rcartocolor::carto_pal(n = 7, name = "ag_Sunset") | |
col2 <- rcartocolor::carto_pal(n=7,name="Burg") | |
Bold <- rcartocolor::carto_pal(n=12,name="Bold") | |
Fall2 <- rcartocolor::carto_pal(n=2,name="Fall") | |
Geyser2 <- rcartocolor::carto_pal(n=2,name="Geyser") | |
library(showtext) | |
font_add_google("Outfit", "Outfit") | |
font_add_google("Cabin", "Cabin") | |
#font_add_google("Montserrat", "Montserrat") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
allHandles <- read_csv("https://raw.githubusercontent.com/USATODAY/clustering-congress-twitter/main/data/source/cong_handles_master_and_ids08082022.csv") | |
cong117 <- allHandles %>% filter(c117th==1) %>% | |
select( | |
twitter_handle = twitter_lower, | |
state, district, party, chamber, | |
Official) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(haven) | |
library(labelled) | |
library(stargazer) | |
# Download data from: https://dataverse.harvard.edu/file.xhtml?fileId=4363671&version=1.0 | |
d2 <- read_dta("Clean Data, Study 2.dta") | |
d2$college_grad <- ifelse(d2$edu >= 5,1,0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Download Nationscape data | |
* [either make a cumulative file, or just use Wave 47, June 2020] | |
* URL: https://www.voterstudygroup.org/publication/nationscape-data-set | |
gen Men = (gender==2) if !mi(gender) | |
recode age (18/29=1 "Age: 18-29 years") (30/44=2 "30-44 years") (45/64=3 "45-64 years") (65/110=4 "65+ years"), gen(age_group) | |
gen registered = (registration==1) if !mi(registration) | |
gen intendsToVote = (vote_intention==1) if !mi(vote_intention) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Get data from Roper center | |
* Downloadable from: https://ropercenter.cornell.edu/ipoll/study/31114169 | |
use "31114169.DTA" | |
* Table: | |
tab hrctrump WIN16 [aw=weight], row nof | |
* 89% of Clinton voters and 61% of third-party voters expected a Clinton victory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Question: how many 2008 Obama voters voted | |
* for a Republican congressional candidate in 2010 and then | |
* voted for Obama in '12? | |
* | |
* Asked by Dan Pfeiffer here https://twitter.com/danpfeiffer/status/1191492977429893120 | |
* Step 1: Download the 2010-2014 Cooperative Congressional Election Study Panel Survey | |
* from https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi%3A10.7910/DVN/TOE8I1 | |
use "CCES_Panel_Full3waves_VV_V4.dta", clear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@article{millennials_democracy, | |
author = {Jan Zilinsky}, | |
title ={Democratic deconsolidation revisited: Young Europeans are not dissatisfied with democracy}, | |
journal = {Research \& Politics}, | |
volume = {6}, | |
number = {1}, | |
year = {2019}, | |
doi = {10.1177/2053168018814332}, | |
URL = {https://doi.org/10.1177/2053168018814332} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear | |
set seed 10009 | |
set obs 100 | |
gen x1 = rnormal() | |
* Induce positive correlation between x1 and x2 | |
gen x2 = rnormal() + .2*x1 | |
* TRUE data-generating process | |
gen y = 1 + x1 + 5*x2 + rnormal() |
NewerOlder