## code to accompany the binomial GLM slides ## from lecture 16 of PSTAT 215A, Bayesian Inference, UCSB ## ## Robert B. Gramacy ## logit is in the boot library library(boot) ## plot g(mu) for mu in [0,1] mu <- seq(0,1,length=100) ## plot the canonical logit link y.logit <- logit(mu) plot(mu, y.logit, type="l", lwd=2, main="Binomal GLM Link Functions", ylab="t(x) %*% beta", xlab="theta_x", bty="n") ## plot the probit link y.probit <- qnorm(mu) lines(mu, y.probit, lwd=2, lty=2, col=2) ## plot the complimentary log=log link y.cll <- log(-log(1-mu)) lines(mu, y.cll, lwd=2, lty=3, col=3) ## add a descriptive legend legend("topleft", c("logit", "probit", "cloglog"), lwd=2, lty=1:3, col=1:3, bty="n")