quasibinomialff()
quasibinomialff(link = "probit")
fit = vgam(agaaus ~ poly(altitude, 2), binomialff(link = cloglog), hunua)
with(hunua, plot(altitude, agaaus, col="blue", ylab="P(agaaus=1)",
main = "Presence/absence of Agathis australis", las = 1))
ooo = with(hunua, order(altitude))
with(hunua, lines(altitude[ooo], fitted(fit)[ooo], col="red", lwd = 2))
# Shows that Fisher scoring can sometime fail. See Ridout (1990).
ridout = data.frame(v = c(1000, 100, 10), r = c(4, 3, 3), n = c(5, 5, 5))
(ridout = transform(ridout, logv = log(v)))
# The iterations oscillates between two local solutions:
glm.fail = glm(r/n ~ offset(logv) + 1, weight=n,
binomial(link = cloglog), ridout, trace = TRUE)
coef(glm.fail)
# vglm()'s half-stepping ensures the MLE of -5.4007 is obtained:
vglm.ok = vglm(cbind(r, n-r) ~ offset(logv) + 1,
binomialff(link = cloglog), ridout, trace = TRUE)
coef(vglm.ok)
Run the code above in your browser using DataLab