Skip to content

Instantly share code, notes, and snippets.

@timcdlucas
Created April 16, 2018 10:02
Show Gist options
  • Save timcdlucas/6ee0cd10cafe8a459bc3b0b03b469c0b to your computer and use it in GitHub Desktop.
Save timcdlucas/6ee0cd10cafe8a459bc3b0b03b469c0b to your computer and use it in GitHub Desktop.
# 1 covariate and intercept
d <- as.matrix(data.frame(intercept = 1, x1 = rnorm(100)))
# Many responses
many_ys <- matrix(d[, 'x1'] * rep(0:10, each = 100) + rnorm(11 * 100, sd = 0.1), ncol = 11)
# Empty list to save our models into.
models <- list()
for(i in 1:11){
models[[i]] <- glm.fit(d, many_ys[, i])
}
models[[5]]$coefficients
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment