FLXmclust              package:flexmix              R Documentation

_F_l_e_x_M_i_x _C_l_u_s_t_e_r_i_n_g _D_e_m_o _D_r_i_v_e_r

_D_e_s_c_r_i_p_t_i_o_n:

     This is a demo driver for 'flexmix' implementing model-based
     clustering of Gaussian data.

_U_s_a_g_e:

     FLXmclust(formula = . ~ ., diagonal = TRUE)
     plotEll(object, data, ...)

_A_r_g_u_m_e_n_t_s:

 formula: A formula which is interpreted relative to the formula
          specified in the call to 'flexmix' using 'update.formula'.
          Only the left-hand side (response) of the formula is used.
          Default is to use the original 'flexmix' model formula.

diagonal: If 'TRUE', then the covariance matrix of the components is
          restricted to diagonal matrices.

  object: An object of class 'flexmix' using 'FLXmclust' model.

    data: The data that were clustered.

     ...: Passed to 'eqscplot'.

_D_e_t_a_i_l_s:

     This is meant as a demo for FlexMix driver programming, use
     package 'mclust' for real applications.

_V_a_l_u_e:

     'FLXmclust' returns an object of class 'FLXmodel'.

_A_u_t_h_o_r(_s):

     Friedrich Leisch

_R_e_f_e_r_e_n_c_e_s:

     Friedrich Leisch. FlexMix: A general framework for finite mixture
     models and latent class regression in R. Journal of Statistical
     Software, 11(8), 2004. http://www.jstatsoft.org/v11/i08/

_S_e_e _A_l_s_o:

     'flexmix'

_E_x_a_m_p_l_e_s:

     data(Nclus)

     require("MASS")
     eqscplot(Nclus)

     ## This model is wrong (one component has a non-diagonal cov matrix)
     ex1 <- flexmix(Nclus~1, k=4, model=FLXmclust())
     print(ex1)
     plotEll(ex1, Nclus)

     ## True model, wrong number of components
     ex2 <- flexmix(Nclus~1, k=6, model=FLXmclust(diag=FALSE))  
     print(ex2)

     plotEll(ex2, Nclus)

     ## Get paramters of first component
     parameters(ex2, component=1)

     ## Have a look at the posterior probabilies of 10 random observations
     ok <- sample(1:nrow(Nclus), 10)
     p  <- posterior(ex2)[ok,]
     p

     ## The following two should be the same
     max.col(p)
     cluster(ex2)[ok]

