# Number of albinotic children in families with 5 children
# Data from Patil (1962)
y = c(rep(1,25), rep(2,23), rep(3,10), 4, 5) # No zeros
n = rep(5, 60)
yprop = y / 5
# Fit the identical models in two ways; MLE of p is 0.3088
fit = vglm(yprop ~ 1, posbinomial, trace=TRUE, weights=n)
fit2 = vglm(cbind(y, n-y) ~ 1, posbinomial, trace=TRUE)
summary(fit)
summary(fit2)
Coef(fit2) # = MLE of p
Coef(fit) # = MLE of p
fitted(fit2)[1:2]
fitted(fit)[1:2]
Run the code above in your browser using DataLab