BMMmodel              package:bayesmix              R Documentation

_C_r_e_a_t_e_s _t_e_x_t _f_o_r ._b_u_g-_f_i_l_e _a_n_d _d_a_t_a _f_o_r -_i_n_i_t_s._R _a_n_d
-_d_a_t_a._R-_f_i_l_e

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

     Creates the text for the BUGS-model specification and the values
     of the initialization, prior specification and the observations
     read in by jags.

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

     BMMmodel(y, k, priors, inits = "initsFS", aprioriWeights = 1,
              no.empty.classes = FALSE, restrict = "none", ...)

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

       y: a numeric vector.

       k: integer indicating the number of segments.

  priors: specification of priors by a named list or a 'BMMpriors'
          object.

   inits: specification of initial values by a named list or string
          indicating the function to be called.

aprioriWeights: specification of prior of the a-priori weights. If
          'aprioriWeights' does not have length = k, there is an equal
          prior for the a-priori weights assumed.

no.empty.classes: logical: should it be prevented that empty classes
          arise during sampling.

restrict: one of "none", "mu", "tau".

     ...: further parameters for the function specified in 'inits'.

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

     By default the function 'initsFS' is called for generating initial
     values. Any other function specified by 'inits' is assumed to have
     at least 'x', 'k' and 'restrict' as input parameters.

     The parameter 'restrict' indicates if a location-shift model
     ("tau"), a scale contaminated model ("mu") or a model where both
     variables vary over components shall be fitted.

     If the logical 'no.empty.classes' is 'TRUE' there are observations
     added to the model that the classes are not empty. This signifies
     that the likelihood when sampling the class affiliations is
     changed thus that any data point which is sampled and is the last
     one in its class stays there.

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

     If 'y' is specified there is an object of class 'BMMmodel'
     returned with components: 

   inits: named list for -inits.R-file.

    data: named list for -data.R-file.

    bugs: text for .bug-file with prefix missing.


     If 'y' is missing there is an object of class 'BMMsetup' returned
     containing the parameter specifications. When 'JAGSsetup' is
     called with this object as model argument, 'BMMmodel' is called
     with 'y' and the other parameters as input arguments before
     creating the input files for jags.

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

     Bettina Gruen

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

     'JAGSrun', 'initsFS'

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

     data(fish)
     model <- BMMmodel(fish, k = 4, priors = list(kind = "independence",
                       parameter = "priorsFish", hierarchical = "tau"),
                       initialValues = list(S0 = 2))
     model

