Skip to content

Instantly share code, notes, and snippets.

Herb Susmann herbps10

View GitHub Profile
@herbps10
herbps10 / SimulationStudy.R
Created May 6, 2020
Optimal treatment effects with resource constraints
View SimulationStudy.R
library(tidyverse)
library(SuperLearner)
#
# Data generating process
#
generate_data <- function(seed, N) {
set.seed(seed)
tibble(
W1 = rnorm(N),
View primary_polls.R
library(tidyverse)
library(rstan)
library(extrafont)
options(mc.cores = 4)
flat_colors <- c(
asbestos = "#7f8c8d",
purple = "#8e44ad"
View primary_polling.R
library(tidyverse)
library(extrafont)
library(rstan)
options(mc.cores = 4)
# Color scheme (flatuicolors.com)
flat_colors <- c(
gray = "#7f8c8d",
purple = "#8e44ad"
View Unsplash Clusters
[{"counts": [0.6145864661654136, 0.2018045112781955, 0.18360902255639097], "clusters": [[180.46978223635966, 17.494250061170842, 30.6598972351362], [134.69150521609527, 117.99403874814013, 118.58047690014729], [38.08599508599687, 16.957411957411665, 22.646191646190612]], "url": "photo-1457419655743-2e0acc6b5122"}, {"counts": [0.9143939393939394, 0.08181818181818182, 0.003787878787878788], "clusters": [[2.3373094764735303, 0.4262756792579032, 0.4671968190855186], [93.09833024118655, 6.63079777365494, 6.4230055658627325], [242.64000000000007, 135.32000000000005, 121.64000000000001]], "url": "photo-1535868463750-c78d9543614f"}, {"counts": [0.5601503759398496, 0.30030075187969923, 0.13954887218045112], "clusters": [[88.69284561592272, 49.448628294782296, 47.02178590640084], [159.28257613579535, 52.66150773839244, 60.10334498252632], [235.12163616792338, 83.13240043057075, 88.37136706135556]], "url": "photo-1498144846853-60ca2d43853b"}, {"counts": [0.4745901639344262, 0.35262295081967215, 0.17278688524590163], "cl
View Unsplash Thumbnail URLs
https://images.unsplash.com/35/4fjHtYHdRlSemICxjjBu_IMG_8424.jpg?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&ixid=eyJhcHBfaWQiOjc3MzYzfQ
https://images.unsplash.com/photo-1497333975316-f4138c0cca11?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&ixid=eyJhcHBfaWQiOjc3MzYzfQ
https://images.unsplash.com/photo-1544476613-163cfbea9300?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&ixid=eyJhcHBfaWQiOjc3MzYzfQ
https://images.unsplash.com/flagged/photo-1536987569896-7bb4bf443404?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&ixid=eyJhcHBfaWQiOjc3MzYzfQ
https://images.unsplash.com/photo-1509595109082-0125495e3436?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&ixid=eyJhcHBfaWQiOjc3MzYzfQ
https://images.unsplash.com/photo-1558694440-03ade9215d7b?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max&ixid=eyJhcHBfaWQiOjc3MzYzfQ
https://images.unsplash.com/photo-1558521594-1e2880f3609e?ixlib=rb-1.2.1&q=80&fm=jpg&cro
View isacatinthesink.R
library(rtweet)
library(tidyverse)
library(stringr)
library(cowplot)
library(grid)
library(jpeg)
g <- rasterGrob(readJPEG("cat.jpg"), interpolate = TRUE)
tmls <- get_timelines("isacatinthesink", n = 10)
View common_squirrel.R
library(rtweet)
library(tidyverse)
library(stringr)
library(cowplot)
library(grid)
library(jpeg)
library(lubridate)
library(tidytext)
g <- rasterGrob(readJPEG("common_squirrel.jpg"), interpolate = TRUE)
View dog_rates.R
# Downloads tweets from @dog_rates and plots
# a histogram of dog ratings.
# Used to generate picture in this tweet:
# https://twitter.com/herbps10/status/959923100468105219
library(rtweet)
library(tidyverse)
library(stringr)
library(cowplot)
library(grid)
@herbps10
herbps10 / nhanes_geometric_mean.R
Last active Aug 17, 2017
Computing geometric means of NHANES variables with 95% confidence intervals
View nhanes_geometric_mean.R
library(survey)
library(RNHANES)
library(tidyverse)
dat <- nhanes_load_data("EPHPP_H", "2013-2014", demographics = TRUE) %>%
filter(!is.na(URXBPH), !is.na(URXBP3))
des <- nhanes_survey_design(dat, "WTSB2YR")
logmean <- svymean(~log(URXBPH), des, na.rm = TRUE)
@herbps10
herbps10 / .block
Last active Mar 1, 2018
comparison
View .block
license: mit
You can’t perform that action at this time.