Skip to content

Instantly share code, notes, and snippets.

Jake Thompson wjakethompson

View GitHub Profile
@wjakethompson
wjakethompson / emip-submission-2017.R
Created Jan 13, 2019
Submission for 2017 EM:IP Cover Showcase
View emip-submission-2017.R
### Define functions -----------------------------------------------------------
logit <- function(x) {
exp(x) / (1 + exp(x))
}
comp <- function(x, y, a1 = 1, a2 = 1, d = 0, c = 0) {
lin_comb <- (a1 * x) + (a2 * y)
c + (1 - c) * logit(lin_comb - d)
}
noncomp <- function(x, y, a1 = 1, a2 = 1, d1 = 0, d2 = 0, c = 0) {
c + (1 - c) * prod(logit((a1 * x) - d1), logit((a2 * y) - d2))
@wjakethompson
wjakethompson / emip-submission-2016.R
Created Jan 13, 2019
Submission for 2016 EM:IP Cover Showcase
View emip-submission-2016.R
# Note: Code and graphic have been updated since original submission
### User input -----------------------------------------------------------------
num_stu <- 20000
num_testlet <- 6
num_item <- 10
set.seed(3567)
@wjakethompson
wjakethompson / ggclock.R
Last active Nov 15, 2018
R code for generating a ggclock
View ggclock.R
library(tidyverse)
library(ggimage)
logo <- "https://www.rstudio.com/wp-content/uploads/2014/06/RStudio-Ball.png"
minutes <- data_frame(x = 0:60, y = 1)
hours <- filter(minutes, x %% 5 == 0)
ggplot() +
geom_point(data = minutes, aes(x = x, y = y), size = 10) +
@wjakethompson
wjakethompson / priors.R
Created Oct 11, 2018
R code for creating plot showing the effect of different priors
View priors.R
library(tidyverse)
library(viridis)
set.seed(92414)
### Draw samples from prior distributions --------------------------------------
# Non-Information: N(-2, 10)
# Weakly Informative: N(-2, 2)
# Informative: N(-2, 1)
View contour_plot.R
# inspired by https://twitter.com/mbostock/status/1036391604100055040
library(tidyverse)
plot_data <- crossing(x = seq(-20, 20, 0.01), y = seq(-20, 20, 0.01)) %>%
mutate(
depth = sin(sin(x * (sin(y) - cos(x)))) - cos(cos(y * (cos(x) - sin(y))))
)
ggplot(plot_data, aes(x = x, y = y)) +
@wjakethompson
wjakethompson / hourly-weather.R
Created Oct 23, 2017 — forked from yeedle/hourly-weather.R
Temperature of every hour in NY since 1973
View hourly-weather.R
library(tidyverse)
library(R.utils)
library(glue)
library(magrittr)
library(weathermetrics)
library(padr)
library(ggExtra)
library(lubridate)
library(scales)
library(hrbrthemes)
View keybase.md

Keybase proof

I hereby claim:

  • I am wjakethompson on github.
  • I am wjakethompson (https://keybase.io/wjakethompson) on keybase.
  • I have a public key ASBxeGlM70OLyoJrv3_ucnr5ldTrOClVZHbjqe9HMMBglQo

To claim this, I am signing this object:

You can’t perform that action at this time.