Created
April 10, 2017 19:28
-
-
Save jebyrnes/195b32f7d5d9c44f0cd3bb5ec17ac2f1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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