Skip to content

Instantly share code, notes, and snippets.

@jebyrnes
Created April 10, 2017 19:28
Show Gist options
  • Save jebyrnes/195b32f7d5d9c44f0cd3bb5ec17ac2f1 to your computer and use it in GitHub Desktop.
Save jebyrnes/195b32f7d5d9c44f0cd3bb5ec17ac2f1 to your computer and use it in GitHub Desktop.
set.seed(1)
x <- 1:150
y <- rbinom(length(x), size = 1, prob = 0.7)
seas_m <- runif(length(x), 0.1, 5)
shape = 0.4
y_true = exp(2 - 0.5 * seas_m)
y <- y*rgamma(length(x), rate = shape / y_true, shape = shape)
non_zero <- ifelse(y > 0, 1, 0)
d <- data.frame(days_at_sea = y, seas_m = seas_m, non_zero = non_zero)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment