Created
January 18, 2018 19:19
-
-
Save timcdlucas/098b86dced909d772f3d40ae9a4863a6 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
x <- 1:100 | |
n <- sapply(x, function(x) rpois(1, x)) | |
pos <- sapply(1:length(n), function(i) rbinom(1, n[i], plogis(x[i] - 50))) | |
p <- pos / n | |
d <- data.frame(p = p, x = x) | |
m <- glm(p ~ x, data = d, weights = n, family = binomial) | |
m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment