Skip to content

Instantly share code, notes, and snippets.

View pratikunterwegs's full-sized avatar

Pratik Gupte pratikunterwegs

View GitHub Profile
#### Handling dates in epidemics ####
library(ggplot2)
library(dplyr)
library(tidyr)
library(purrr)
contact_matrix <- matrix(1)
demography_vector <- c(10e6)
# make initial conditions - order is important
@pratikunterwegs
pratikunterwegs / epiverse_palette_trial.R
Last active February 23, 2024 12:09
Trial a categorical palette from Epiverse colours
#### Examining Epiverse colours for categorical palettes ####
library(colorspace)
pal_original = c(
black = "#071E2D", grey = "#888888", red = "#F04A4C", blue = "#106BA0",
green = "#AEC800", teal = "#10BED2", yellow = "#DEFF00", white = "#EBE6E0"
)
specplot(pal_original)
@pratikunterwegs
pratikunterwegs / epidemics_api_options.R
Last active February 7, 2024 10:14
API options for {epidemics}
#### Dummy internal fn ####
f_internal <- function(x) x
#### Dummy internal stochastic fn ####
# some function of the input (fixed) and draws from a distr (stochastic)
# assumes a param beta at position 3
f_internal_stochastic <- function(x) x[[3]] + runif(length(x))
#### Single parameter set and single intervention ####
# function operates on some parameters with one run per parameter
@pratikunterwegs
pratikunterwegs / plot_epiverse_network.R
Last active July 5, 2023 21:34
Plotting the Epiverse-TRACE interaction network
library(tidyverse)
library(readxl)
library(tidygraph)
library(scico)
library(ggraph)
# read data on connections
df <- read_excel("contact_matrix.xlsx",
sheet = "matrix"