set.seed(1)
## Using 'Mult' with 'Exp' to constrain the first constituent multiplier
data(yaish)
## 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))
## (this example can take quite a while to run)
##
## Using 'multiplicity' > 1
data(wheat)
yield.scaled <- wheat$yield * sqrt(3/1000)
treatment <- factor(paste(wheat$tillage, wheat$summerCrop, wheat$manure,
wheat$N, sep = ""))
bilinear2 <- gnm(yield.scaled ~ year + treatment +
Mult(year, treatment, multiplicity = 2),
family = gaussian, data = wheat)
Run the code above in your browser using DataLab