stepFlexmix             package:flexmix             R Documentation

_R_u_n _F_l_e_x_M_i_x _R_e_p_e_a_t_e_d_l_y

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

     Runs flexmix repeatedly for different numbers of components and
     return the maximum likelihood solution for each.

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

     stepFlexmix(..., K=NULL, nrep=3,
                 compare=c("logLik", "BIC", "AIC"), verbose=TRUE)

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

     ...: passed to 'flexmix'

       K: A vector of integers passed in turn to the 'k' argument of
          'flexmix'

    nrep: For each value of 'k' run 'flexmix' 'nrep' times and keep
          only the solution with maximum likelihood.

 compare: Goodness of fit measure used to select the best model, one of
          '"logLik"', '"BIC"' or '"AIC"'.

 verbose: If 'TRUE', show progress information during computations.

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

     A list of objects of class '"flexmix"' if 'length(K)>1', else
     directly an object of class '"flexmix"'.

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

     Friedrich Leisch

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

     data(NPreg)

     ## try 5 times for k=2
     ex1 <- stepFlexmix(yn~x+I(x^2), data=NPreg, K=2, nrep=5)
     ex1

     ## now for k=2,3,4,5
     ## low nrep to have reasonable execution time of example
     ## even on slow systems
     ex2 <- stepFlexmix(yn~x+I(x^2), data=NPreg, K=2:5, nrep=2)
     ex2
     sapply(ex2, logLik)

     ## model selection:
     sapply(ex2, AIC)
     sapply(ex2, BIC)

