Skip to content

Instantly share code, notes, and snippets.

@timcdlucas
Created January 20, 2016 11:37
Show Gist options
  • Save timcdlucas/a7d0902f6e8dafb47861 to your computer and use it in GitHub Desktop.
Save timcdlucas/a7d0902f6e8dafb47861 to your computer and use it in GitHub Desktop.
equations for predicting cloglog models
d <- data.frame(x = rnorm(100) + c(1, 2), y = c(0, 1))
m <- glm(y ~ x, data = d, family = binomial(link = cloglog))
newx <- seq(-5, 5, length.out = 100)
predict.line <- predict(m, newdata = data.frame(x = newx), type = 'response')
plot(y ~ x, d)
lines(predict.line ~ newx)
manual.predict <- 1-exp( -exp(m$coefficients['(Intercept)'] + m$coefficients['x']*newx))
lines(manual.predict ~ newx, col = 'red')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment