Skip to content

Instantly share code, notes, and snippets.

@joftius
joftius / norm_approx_binom
Created August 25, 2022 17:36
Visualizing the Normal approximation to the Binomial
library(tidyverse)
df <- data.frame(x = 0:20, y = dbinom(0:20, size = 20, prob = .4))
# Plot pdf of Bin(20, 0.4)
ggplot(df, aes(x, y)) +
geom_bar(stat = "identity", alpha = .4) +
geom_bar(stat = "identity", alpha = .9, data = subset(df, x > 4 & x <= 7)) +
ylab("Binomial probability") +
theme_minimal()
We can't make this file beautiful and searchable because it's too large.
"external_author_id","author","content","region","language","publish_date","harvested_date","following","followers","updates","post_type","account_type","new_june_2018","retweet","account_category"
9.06e+17,"10_GOP","Sanders: ""Last chapter of Hillary Clinton's public life is going to be defined by propping up book sales with false &amp; reckless attacks"" 🔥🔥 https://t.co/NrgnYEcFwK","Unknown","English","9/12/2017 19:15","9/12/2017 19:15",952,3811,57,NA,"Right",0,0,"RightTroll"
4036537452,"4MYSQUAD","Reality of #reparations https://t.co/8ybD1dh5xO #Blacklivesmatter #BernieSanders #slavery #Blacktwitter https://t.co/1toCKVmfG2","United States","English","1/25/2016 23:45","1/25/2016 23:45",4560,2205,918,NA,"left",0,0,"LeftTroll"
4036537452,"4MYSQUAD","#EricGarner's daughter endorses @BernieSanders https://t.co/xI33PC7aQZ #BlackLivesMatter https://t.co/N02DkQ73BN","United States","English","1/29/2016 21:00","1/29/2016 21:00",3332,2233,970,NA,"left",0,0,"LeftTroll"
4036537452,"4MYSQUAD","Didn't know th
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 71 columns, instead of 25. in line 1.
"","state","dist","year","dem","redist1","redist2","vote_P0","cand_dwnom0","prim_total0","vote_P1","cand_dwnom1","fully_open_general","this_primary_open","this_primary_open_other_inc","this_primary_inc_other_open","both_primaries_inc","tot_amountQ","tot_amountY","absdist","rv","treat","rv_treat","dv","margin","rv2","rv3","rv4","prim_total_winner","prim_pac_share","prim_share","winner_score","inc_winner","party_share","group_share","pnv","lag_pnv","dv_win","lag_dv_party","vote_G_comb","lag_dv_vote","lag_dv_pac","dv2","dv_win2","dv3","dv_win3","dv4","dv_win4","dv5","dv_win5","dv_lag","dv_win_lag","safe_for_party","competitive","dwnom1","dw1","dw2","dw3","dw4","dw_lag","cov2dc","qual_D","qual_R","qual","winner_hall_snyder_score","wnom1","lag_wnom1","abs_lag_wnom","abs_dw_lag","winner_female","winner_share"
"1","AL",1,1984,1,98,103,0.454907208681107,-0.0739719569683075,9258,0.545092761516571,-0.0343234688043594,1,1,0,0,0,59186.09375,8805.58203125,0.0396484881639481,-0.0450927913188934,0,0,0.489986747503281,0.0450