update
[morpheus.git] / patch_Bettina / code.R
CommitLineData
cbd88fe5
BA
1library("flexmix")
2data("tribolium", package = "flexmix")
3set.seed(1234)
4## uses FLXMRglm() from package.
5tribMix <- initFlexmix(cbind(Remaining, Total - Remaining) ~ Species,
6 k = 2, nrep = 5, data = tribolium,
7 model = FLXMRglm(family = "binomial"))
8parameters(tribMix); logLik(tribMix)
9source("FLXMRglm.R")
10set.seed(1234)
11## uses FLXMRglm() from source file which allows to specify link.
12tribMixNew <- initFlexmix(cbind(Remaining, Total - Remaining) ~ Species,
13 k = 2, nrep = 5, data = tribolium,
14 model = FLXMRglm(family = "binomial"))
15parameters(tribMixNew); logLik(tribMixNew)
16set.seed(1234)
17tribMixlogit <- initFlexmix(cbind(Remaining, Total - Remaining) ~ Species,
18 k = 2, nrep = 5, data = tribolium,
19 model = FLXMRglm(family = binomial(link = logit)))
20parameters(tribMixlogit); logLik(tribMixlogit)
21set.seed(1234)
22tribMixprobit <- initFlexmix(cbind(Remaining, Total - Remaining) ~ Species,
23 k = 2, nrep = 5, data = tribolium,
24 model = FLXMRglm(family = binomial(link = probit)))
25parameters(tribMixprobit); logLik(tribMixprobit)