swh:1:snp:dc80812a22a7696ce24055bd58afbf9f13e3e78c
Tip revision: 99591d5078a438ce6dcb5042d265b7a1e1ccc03c authored by Bettina Gruen on 28 May 2009, 00:00:00 UTC
version 2.2-3
version 2.2-3
Tip revision: 99591d5
binomial.Rout.save
R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library("flexmix")
Loading required package: lattice
Loading required package: modeltools
Loading required package: stats4
Loading required package: multcomp
Loading required package: mvtnorm
>
> set.seed(123)
>
> klassen <- rep(1:2, c(800, 200))
>
> z<-rep(0,1000)
> z[1:800] <- rbinom(800, 3, prob=0.9)
> z[801:1000] <- rbinom(200, 3, prob=0.1)
> z <- cbind(z, 3-z)
>
> ex1 <- flexmix(z~1, k=2, model= FLXMRglm(family="binomial"))
> table(wahr=klassen, flexmix=clusters(ex1))
flexmix
wahr 1 2
1 23 777
2 197 3
>
> y <- runif(1000)
> z<-rep(0,1000)
> z[1:800] <- rbinom(800, 3, prob=y[1:800])
> z[801:1000] <- rbinom(200, 3, prob=1-y[801:1000])
> z <- cbind(z, 3-z)
>
> ex2 <- flexmix(z~y, k=2, model= FLXMRglm(family="binomial"))
> table(wahr=klassen, flexmix=clusters(ex2))
flexmix
wahr 1 2
1 31 769
2 115 85
>
>
>