gamlssMX              package:gamlss.mx              R Documentation

_F_u_n_c_t_i_o_n _t_o _f_i_t _f_i_n_i_t_e _m_i_x_t_u_r_e _o_f _g_a_m_l_s_s _f_a_m_i_l_y _d_i_s_t_r_i_b_u_t_i_o_n_s

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

     The  function 'gamlssMX' is design for fitting a K fold non
     parametric mixture of gamlss family distributions.

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

     gamlssMX(formula = formula(data), pi.formula = ~1, 
              family = "NO", weights, K = 2, prob = NULL, 
              data = sys.parent(), control = MX.control(), 
              g.control = gamlss.control(trace = FALSE), 
              zero.component = FALSE,   ...)
     gamlssMXfits(n = 5, formula = formula(data), pi.formula = ~1, 
              family = "NO", weights, K = 2, prob = NULL, 
              data = sys.parent(), control = MX.control(), 
              g.control = gamlss.control(trace = FALSE),
              zero.component = FALSE, ... )

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

 formula: This argument it should be a formula (or a list of formulea
          of length K) for modelling the 'mu' parameter of the model.
          Note that modelling the rest of the distributional parameters
          it can be done by using the usual '...' which passes the
          arguments to 'gamlss()' 

pi.formula: This should be a formula for modelling the prior
          probabilities as a function of explanatory variables. Note
          that no smoothing of other additive terms are allowed here
          only the usual linear terms. The modelling here is done using
          the 'multinom()' function from package 'nnet'

  family: This should be a 'gamlss.family' distribution (or a list of
          distributions). Note that if different distributions are used
          here their parameters should be comparable for ease of
          interpretation.

 weights: prior weights if needed

       K: the number of finite mixtures with default 'K=2' 

    prob: prior probabilities if required for starting values

    data: the data frame nedded for the fit. Note that this is
          compulsory if 'pi.formula' is used.

 control: This argument sets the control parameters for the EM
          iterations algorithm. The default setting are given in the
          'MX.control' function  

g.control: This argument can be used to pass to 'gamlss()' control
          parameters, as in 'gamlss.control' 

       n: the number of fits required in 'gamlssMXfits()'

zero.component: whether zero component models exist, default is 'FALSE'

     ...: for extra arguments

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

     Mikis Stasinopoulos and Bob Rigby

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

     Rigby, R. A. and  Stasinopoulos D. M. (2005). Generalized additive
     models for location, scale and shape, (with discussion), _Appl.
     Statist._, *54*, part 3, pp 507-554.

     Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2003)
     Instructions on how to use the GAMLSS package in R. Accompanying
     documentation in the current GAMLSS  help files, (see also  <URL:
     http://www.gamlss.com/>).

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

     'gamlss', 'gamlss.family'

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

     library(MASS)
     data(geyser)
     # fitting 2 finite normal mixtures 
     m1<-gamlssMX(waiting~1,data=geyser,family=NO, K=2)
     #fitting 2 finite gamma mixtures 
     m2<-gamlssMX(waiting~1,data=geyser,family=GA, K=2)
     # fitting a model for pi
     # first create a data frame
     geyser1<-matrix(0,ncol=2, nrow=298)
     geyser1[,1] <-geyser$waiting[-1]
     geyser1[,2] <-geyser$duration[-299]
     colnames(geyser1)<- c("waiting", "duration")
     geyser1 <-data.frame(geyser1)
     # get the best of 5 fits
     m3<-gamlssMXfits(n=5, waiting~1, pi.formula=~duration, data=geyser1,family=NO, K=2)
     m3

