RtreemixModel-class         package:Rtreemix         R Documentation

_C_l_a_s_s "_R_t_r_e_e_m_i_x_M_o_d_e_l"

_D_e_s_c_r_i_p_t_i_o_n:

     This class contains all the data needed for characterizing the
     mutagenetic trees mixture model (mixture parameters, mixture
     components, ...). The tree components of the model are given as a
     list of directed 'graphNEL' objects.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Objects can be created by calls of the form 'new("RtreemixModel",
     ParentData, Weights, WeightsCI, Resp, CompleteMat, Star, Trees)'.
     The 'RtreemixModel' class extends the 'RtreemixData' class and
     specifies the mutagenetic trees mixture model. If the model is not
     randomly generated the parent class gives the 'RtreemixData' used
     for learning the mixture model. The directed trees that build up
     the model are represented as a list of directed 'graphNEL'
     objects, and their weights (the mixture parameters) are given as a
     numeric vector. This class can also contain other useful
     information connected with the mixture model like confidence
     intervals for the mixture parameters and the edge weights
     (resulting from a bootstrap analysis), an indicator for the
     presence of the star component, etc. They are all listed in the
     text below with brief descriptions.

     The 'ParentData' is an 'RtreemixData' object that specifies the
     data used for estimating the mutagenetic trees mixture model. It
     is not specified for random mixture models, since they are not
     estimated from a given dataset but generated randomly.

     The 'Weights' is a numeric 'vector' that contains the mixture
     parameters of the model. Its length equals the length of the
     'list' of tree components 'Trees'.

     The 'WeightsCI' is a named 'list' with length equal to the length
     of the 'Weights'. Each list element is a numeric 'vector' of
     length two specifying the lower and upper bound of the confidence
     interval for the corresponding mixture parametar. The confidence
     intervals are derived using the bootstrap method.

     The 'Resp' is a numeric 'matrix' that specifies the responsibility
     of each tree component to generate each of the patterns in the
     'ParentData'. The number of rows in 'Resp' is equal to the number
     of trees in the mixture (the length of the list 'Trees') and the
     number of columns equals the number of patients in 'ParentData'.
     For random mixture models it is an empty matrix, since they are
     not estimated from a given dataset.

     The 'CompleteMat' is a binary 'matrix' that specifies the complete
     data in case some measurements for some patients are missing in
     the data used for learning the model (the 'ParentData'). It has
     the same size as the matrix specifying the data in 'ParentData'.
     The missing data are estimated in the EM-algorithm used for
     fitting the mixture model. When there are no missing data in
     'ParentData', or the model is randomly generated the 'CompleteMat'
     is an empty matrix. 

     The 'Star' is an indicator of the presence of a noise (star)
     component and is mostly relevant for models with a single tree
     component, since it is assumed that  mixture models with at least
     two components always have the noise as a first component. It is
     of type 'logical'.

     The 'Trees' is a 'list' of directed 'graphNEL' objects, each for
     every tree component in the mixture model. The genetic events are
     represented as nodes in the graphs. The 'edgeData' of each tree
     can have two attributes: '"weight"' and '"ci"'. Please see the
     help page on 'graph-class' and 'graphNEL-class' in the package
     'graph'. The '"weight"' attribute is for edge weight, i.e. the
     conditional probability that the child event of the edge occured
     given that the parent event already occured. The '"ci"' attribute
     is for the bootstrap confidence intervals for the edge weight (a
     numeric vector with length two).

_S_l_o_t_s:


     '_W_e_i_g_h_t_s': Object of class '"numeric"'. The length of the
          'Weights' must be equal to the length of 'Trees'. 

     '_W_e_i_g_h_t_s_C_I': Object of class '"list"'. The length of the
          'WeightsCI' must be equal to the length of 'Weights'.  

     '_R_e_s_p': Object of class '"matrix"'. The number of rows of 'Resp'
          must be identical to the length of 'Trees', and its number of
          columns to the number of patients in the dataset used for
          estimating the mixture model ('ParentData').

     '_C_o_m_p_l_e_t_e_M_a_t': Object of class '"matrix"'. When specified (when
          there are missing data) the size of the 'CompleteMat' must be
          equal to the size of the matrix used to estimate the model.

     '_S_t_a_r': Object of class '"logical"'. 

     '_T_r_e_e_s': Object of class '"list"'. The length of 'Trees' equals
          the length of 'Weights'.

_E_x_t_e_n_d_s:

     Class '"RtreemixData"', directly.

_M_e_t_h_o_d_s:


     _C_o_m_p_l_e_t_e_M_a_t 'signature(object = "RtreemixModel")': A method used
          for obtaining the complete dataset, in case there were any
          missing measurements for some patients in the dataset used to
          learn the mixture model.

     _R_e_s_p 'signature(object = "RtreemixModel")': A method for obtaining
          the matrix of responsibilities for the trees to generate each
          of the samples in the dataset used for learning the model
          ('ParentData').    

     _S_t_a_r 'signature(object = "RtreemixModel")': A method for checking
          the presence of a noise component in the mixture model
          (informative only for models with one tree component).   

     _T_r_e_e_s 'signature(object = "RtreemixModel")': A method for
          obtaining the tree components of the mixture model as a list
          of directed 'graphNEL' objects. 

     _W_e_i_g_h_t_s 'signature(object = "RtreemixModel")': A method for
          obtaining the mixture parameters (the weights of the trees in
          the model).

     _W_e_i_g_h_t_s<- 'signature(object = "RtreemixModel")': A method for
          replacing the value of the slot 'Weights' with a specified
          'numeric' vector. The components of this vector have to sum
          up to one.

     _W_e_i_g_h_t_s_C_I 'signature(object = "RtreemixModel")': A method for
          obtaining the weights of the mixture parameters. 

     _g_e_t_D_a_t_a 'signature(object = "RtreemixModel")': A method for
          obtaining the 'ParentData' of the mixture model, i.e. the
          data used for learning the model. 

     _g_e_t_T_r_e_e 'signature(object = "RtreemixModel", k = "numeric")': A
          method for obtaining the k-th tree component of the mixture
          model as a directed 'graphNEL' object.

     _n_u_m_T_r_e_e_s 'signature(object = "RtreemixModel")': A method for
          obtaining the number of tree components building up the
          mixture model.

_A_u_t_h_o_r(_s):

     Jasmina Bogojeska

_R_e_f_e_r_e_n_c_e_s:

     Learning multiple evolutionary pathways from cross-sectional data,
     N. Beerenwinkel et al.

_S_e_e _A_l_s_o:

     'RtreemixGPS-class', 'RtreemixStats-class', 'RtreemixData-class',
     'RtreemixSim-class', 'fit-methods', 'bootstrap-methods',
     'generate-methods', 'comp.models', 'comp.trees'

_E_x_a_m_p_l_e_s:

     ## Generate a random RtreemixModel object with 2 components.
     rand.mod <- generate(K = 2, no.events = 9, noise.tree = TRUE, prob = c(0.2, 0.8))
     show(rand.mod)
     plot(rand.mod) ## plot the tree components of the model
     plot(rand.mod, k = 2) ## plot the second component of the model

     ## Draw data from a specified mixture model.
     draws <- sim(model = rand.mod, no.draws = 200)
     show(draws)

     ## Create an RtreemixModel object by fitting model to the drawn data.
     mod <- fit(data = draws, K = 2, equal.edgeweights = TRUE, noise = TRUE)
     show(mod)

     ## See the values of the slots of the RtreemixModel object.
     Weights(mod)
     Resp(mod)
     CompleteMat(mod)
     Star(mod)
     Trees(mod)
     ## See data used for learning the model.
     getData(mod)
     ## See the number of tree components in the mixture model.
     numTrees(mod)
     ## See a specific tree component k.
     getTree(object = mod, k = 2)
     ## See the conditional probabilities assigned to edges of the second tree component.
     edgeData(getTree(object = mod, k = 2), attr = "weight")
     ## See the probability distribution encoded by the model on the set of all possible patterns.
     distr <- distribution(model = mod)
     distr
     ## Get the probabilities.
     distr$probability
     ## See the probability distribution encoded by the model on the set of all possible patterns
     ## calculated for given sampling mode, and input and output parameters.
     distr1 <- distribution(model = mod, sampling.mode = "exponential", sampling.param = 1, output.param = 1)
     distr1

     ## Create a RtreemixModel and analyze its variance with the bootstrap method.
     mod.boot <- bootstrap(data = draws, K = 2, equal.edgeweights = TRUE, B = 100)

     ## See the confidence intervals for the mixture parameters (the weights).
     WeightsCI(mod.boot)
     ## See the confidence intervals of the conditional probabilities assigned to the edges.
     edgeData(getTree(mod.boot, 2), attr = "ci")

