Created
March 3, 2021 22:27
-
-
Save samclifford/2dced2020e89c235103d3083fbdce978 to your computer and use it in GitHub Desktop.
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) | |
expand.grid(day = 1:7, week = 1:13) %>% | |
mutate(mu = 3*sin(day*2*pi/7)) %>% | |
mutate(p = boot::inv.logit(mu)) %>% | |
mutate(obs = rbinom(n(), size = 1, p = p), | |
pred = rbinom(n(), size = 1, p = p)) %>% | |
gather(key, value, obs, pred) %>% | |
mutate(value = factor(value)) %>% | |
ggplot(data =., aes(x = day, y = key)) + | |
geom_tile(aes(fill = value)) + | |
coord_equal() + | |
facet_grid(week ~ .) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment