Skip to content

Instantly share code, notes, and snippets.

View IFR R Code
## Affan's reproduce
library(distributions3)
library(ggplot2)
library(tidyverse)
library(R.utils)
library(zoo)
library(tictoc)
#load("formatted_US_death_data.rds")
View back calculation ellie
rm(list = ls())
library(nimble)
library(coda) # For manipulation of MCMC results.
library(mgcv)
library(ggplot2)
library(ggpubr)
#library(tidyverse) # not on the cluster
library(ggmcmc)
View get age-distribution
function get_agedist(st)
grps = (0:4, 5:16, 17:49, 50:65, 66:99)
_data = CSV.File("sc-est2019.csv") |> DataFrame!
# select only the relevant columns
select!(_data, Not(8:17))
# filter to include both male/female, state
filter!(r -> r[:SEX] == 0 && r[:NAME] == st && r[:AGE] <= 99, _data)
# calculate the the age groups
transform!(_data, :AGE => ByRow(x -> findfirst(grp -> x in grp, grps)) => :AGEGRP)
View gist:8a82537629bfe99860110e692d9c8d29
julia> a = "test"; expr = "$a = zeros(Float64, 10)" # note the string is interpolated, easier to read
"test = zeros(Float64, 10)"
julia> julia_expr = Meta.parse(expr)
:(test = zeros(Float64, 10))
julia> dump(julia_expr) # see the Abstract Syntax Tree of the expression (only for informational purposes)
Expr
head: Symbol =
args: Array{Any}((2,))
@affans
affans / covid19 - basic dynamical system
Last active Mar 9, 2021
COVID-19 Model Implemention
View covid19 - basic dynamical system
# Affan Shoukat
# Center for Infectious Disease Modelling and Analysis
# Yale University, Dec 2020
# Repository: https://gist.github.com/affans/f529f8cd727989143c979afd9174b984
module covid19ode
using OrdinaryDiffEq
using Parameters
using LinearAlgebra
using ForwardDiff
using ProgressMeter
View SIR.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@affans
affans / startup.jl
Created Jul 29, 2019
My Julia `startup.jl`
View startup.jl
## push local working path for all code.
push!(LOAD_PATH, "$(homedir())/Documents/Repository")
## load packages
using BenchmarkTools
using Logging
# remove from production
logger = SimpleLogger(stdout, Logging.Debug)
global_logger(logger)
@info "Debug Logging is on for this session."
@affans
affans / cdiffcosts.md
Last active Dec 18, 2018
cdiff costs
View cdiffcosts.md

Data Table for Cost-Effectiveness

Column Name Description
mc Sim Number
uid Patient unique ID
duration.stay.days ?
isolation.days ?
symptom.days ?
is.symptomatic T/F if patient is symptomatic
View gist:442a9ac186df115a2166a7c1f3fecb10
using srun from command line
srun -J $jobname -n $np -o "job%4t.out" -D $exehome $(srunargs) $exename $exeflags $worker_arg
or sbatch script
#!/bin/sh
#SBATCH --partition=defq
#SBATCH --nodes=16
#SBATCH --ntasks=512