data("patent", package = "flexmix")
patentMix <- initFlexmix(Patents ~ lgRD, k = 3,
model = FLXMRglm(family = "poisson"),
concomitant = FLXPmultinom(~RDS),
nrep = 5, data = patent)
plot(Patents ~ lgRD, data = patent,
pch = as.character(clusters(patentMix)))
ordering <- order(patent$lgRD)
apply(fitted(patentMix), 2, function(y)
lines(sort(patent$lgRD), y[ordering]))
Run the code above in your browser using DataLab