swh:1:snp:dc80812a22a7696ce24055bd58afbf9f13e3e78c
Tip revision: c7212c9bb00ec391e23e801e03977a021120dc25 authored by Friedrich Leisch on 31 October 2005, 00:00:00 UTC
version 1.1-1
version 1.1-1
Tip revision: c7212c9
binomial.Rout.save
R : Copyright 2005, The R Foundation for Statistical Computing
Version 2.1.0 Under development (unstable) (2005-03-11), 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 a HTML browser interface to help.
Type 'q()' to quit R.
> library(flexmix)
>
> 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= FLXglm(family="binomial"))
> table(wahr=klassen, flexmix=cluster(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= FLXglm(family="binomial"))
> table(wahr=klassen, flexmix=cluster(ex2))
flexmix
wahr 1 2
1 31 769
2 115 85
>
>
>