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