# Fit the model in Table 6.7 in McCullagh and Nelder (1989)
data(coalminers)
coalminers = transform(coalminers, Age = (age - 42) / 5)
fit = vglm(cbind(nBnW,nBW,BnW,BW) ~ Age, binom2.or(zero=NULL), coalminers)
fitted(fit)
summary(fit)
coef(fit, matrix=TRUE)
attach(coalminers)
matplot(Age, fitted(fit), type="l", las=1, xlab="(age - 42) / 5",
main=paste("B=Breathlessness, W=Wheeze; 1=(B=0,W=0),",
"2=(B=0,W=1), 3=(B=1,W=0), 4=(B=1,W=1)"))
matpoints(Age, fit@y, col=1:4)
detach(coalminers)
Run the code above in your browser using DataLab