Skip to content

Instantly share code, notes, and snippets.

@herbps10
herbps10 / Error message
Last active September 22, 2022 16:51
Minimum Reproducible Example: Stan Include File
Compiling Stan program...
Syntax error in '/var/folders/mw/nw_yn9hs0wd6flz32fwr81sh0000gn/T/RtmphVRHT8/model-9541147ec224.stan', line 2, column 0, include error:
-------------------------------------------------
1: functions {
2: #include multiply.stan
^
3: }
4: data {
-------------------------------------------------
@herbps10
herbps10 / README.md
Last active May 6, 2021 14:59
Annotated Slides

Annotated Slides

This is a webpage that shows a set of slides from a PDF along with annotations provided in a separate Markdown file. You can see this page live at: herbsusmann.com/paa2021.

To use this code for your own slides, you need to update the following code in index.html:

First, update the paths to the PDF and Markdown files:

var pdfUrl = './paa_2021_tmmps.pdf';
var textUrl = "./paa_2021.md";
@herbps10
herbps10 / SimulationStudy.R
Created May 6, 2020 17:48
Optimal treatment effects with resource constraints
library(tidyverse)
library(SuperLearner)
#
# Data generating process
#
generate_data <- function(seed, N) {
set.seed(seed)
tibble(
W1 = rnorm(N),
library(tidyverse)
library(rstan)
library(extrafont)
options(mc.cores = 4)
flat_colors <- c(
asbestos = "#7f8c8d",
purple = "#8e44ad"
library(tidyverse)
library(extrafont)
library(rstan)
options(mc.cores = 4)
# Color scheme (flatuicolors.com)
flat_colors <- c(
gray = "#7f8c8d",
purple = "#8e44ad"
[{"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
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
@herbps10
herbps10 / isacatinthesink.R
Created February 25, 2018 23:48
isacatinthesink
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)
@herbps10
herbps10 / common_squirrel.R
Created February 25, 2018 23:46
common squirrel
library(rtweet)
library(tidyverse)
library(stringr)
library(cowplot)
library(grid)
library(jpeg)
library(lubridate)
library(tidytext)
g <- rasterGrob(readJPEG("common_squirrel.jpg"), interpolate = TRUE)
# 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)