data(yaish)
set.seed(1)
## Fit the "UNIDIFF" mobility model across education levels
unidiff <- gnm(Freq ~ educ*orig + educ*dest +
Mult(Exp(-1 + educ), -1 + orig:dest), family = poisson,
data = yaish, subset = (dest != 7))
## Deviance is 200.3
## Get estimate and se for the contrast between educ4 and educ5 in the
## UNIDIFF multiplier
educ4.pos <- grep("Mult.*educ4", names(coef(unidiff)))
mycontrast <- rep(0, length(coef(unidiff)))
mycontrast[educ4.pos] <- 1
mycontrast[educ4.pos + 1] <- -1
se(unidiff, mycontrast)
## Get all of the contrasts with educ5 in the UNIDIFF multipliers
getContrasts(unidiff, rev(grep("Mult.*educ", names(coef(unidiff)))))
Run the code above in your browser using DataLab