{{ message }}

Instantly share code, notes, and snippets.

# Travis Hinkelman hinkelman

Last active Jun 6, 2021
Shiny app referenced in https://www.travishinkelman.com/visualize-scheme-library/
View NetworkGraphApp.R
View CountGLM.R
 n = 100 # No. of samples per treatment mean.A = 10 # Mean count for treatment A mean.B = 5 # Mean count for treatment B nd = data.frame(Trt = c("A", "B")) # Used in predict( ) function # Generate example data based on Poisson distribution (mean = variance) data.pois = data.frame(Trt = c(rep("A", n), rep("B", n)), Response = c(rpois(n, mean.A), rpois(n, mean.B)) )
Created Nov 8, 2020
Code to accompany blog post at https://www.travishinkelman.com/stochastic-population-model-fsharp/
View Program.fs
 // Learn more about F# at http://fsharp.org open MathNet.Numerics.Distributions [] let main argv = let yinit = 1.0 // initial population size let r = 1.4 // maximum population growth rate let k = 20.0 // carrying capacity let thetasd = 0.1 // standard deviation for adding noise to the population
Created May 26, 2019
Temperature converter
View tempconv.rkt
 #lang racket/gui (define (convert-c C) (number->string (+ 32 (* C (/ 9 5))))) (define (convert-f F) (number->string (* (- F 32) (/ 5 9)))) (define (update-fahrenheit control event) (define tc (send text-celsius get-value))
Last active Apr 12, 2019
View stochastic-logistic-typed.rkt
 #lang typed/racket (require math) (provide logmod-typed repeat-logmod-typed) (: logmod-typed : Integer Flonum Flonum Flonum Flonum -> (Listof Flonum)) (define (logmod-typed t y r k thetasd) (: calc : Flonum -> Flonum)
Created Mar 17, 2019
Deterministic multistage Beverton-Holt model using nested for loops and math/array in Racket
View NestedForLoopMatrix.rkt
 #lang racket/base (require math/array) ;; scalar constants (define years 30) (define prop-female 0.5) (define egg-surv 0.6) ;; age-specific fecundity and survival
Last active Mar 16, 2019
Deterministic multistage Beverton-Holt model using nested for loops in Racket
View NestedForLoop.rkt
 #lang racket/base ;; scalar constants (define years 30) (define prop-female 0.5) (define egg-surv 0.6) ;; age-specific fecundity and survival (define fecundity #(0 0 200 400 800)) (define survival #(0.2 0.4 0.6 0.8 0))
Created Feb 10, 2019
Deterministic multistage Beverton-Holt model using nested for loops in R
View NestedForLoop.R
 years = 30 prop_female = 0.5 egg_surv = 0.6 fecundity = c(0, 0, 200, 400, 800) survival = c(0.2, 0.4, 0.6, 0.8, 0) capacity = c(1e6, 1e5, 1e4, 1e3, 1e2) beverton_holt <- function(N, p, c){ N / ((1/p) + (N/c))
Created Oct 14, 2016
Introduction to Shiny; example app for BDRUG
View DSM2Output.csv
We can't make this file beautiful and searchable because it's too large.
 "channel","node","vernalis","exports","flow","velocity","x","y" 4,4,1000,0,969.790262132084,0.833772895225137,-121.29817237656,37.72732907252 5,5,1000,0,966.678046818172,0.420142753298407,-121.30444610376,37.75555827741 6,6,1000,0,963.342403924193,0.54710980964832,-121.2996210542,37.77848204796 7,7,1000,0,956.496675449787,0.429192187612527,-121.30954298619,37.79515816156 8,8,1000,0,348.716704417241,0.184562928060122,-121.32714237745,37.80844673355 9,9,1000,0,339.106591970945,0.25899282861556,-121.31236061573,37.82533038655 10,10,1000,0,326.924472117507,0.228500333479895,-121.3218469994,37.84554246538 11,11,1000,0,315.949902308369,0.219456529459077,-121.32691216832,37.8656012755
Created Oct 17, 2013
Demo of problem with renderUI and animation slider
View server.R
 library(shiny) grp <- c(rep("A", 900), rep("B", 1200)) # Define server logic for slider examples shinyServer(function(input, output) { sub <- reactive({ grp[grp %in% input\$group] })