sim-methods             package:Rtreemix             R Documentation

_M_e_t_h_o_d _f_o_r _s_i_m_u_l_a_t_i_n_g _d_a_t_a _f_r_o_m _a _m_u_t_a_g_e_n_e_t_i_c _t_r_e_e_s _m_i_x_t_u_r_e _m_o_d_e_l

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

     This function draws a certain number of patterns from a specified
     mutagenetic trees mixture model. Thus, the mixture model has to be
     specified. When besides the mixture model also the sampling mode
     and its respective sampling parameter are specified, this function
     simulates patterns together with their waiting and sampling times
     from the respective model.

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

     ## S4 method for signature 'RtreemixModel, missing,
     ##   missing':
     sim(model, sampling.mode,
     sampling.param, ...)
     ## S4 method for signature 'RtreemixModel, character,
     ##   numeric':
     sim(model, sampling.mode,
                                 sampling.param, ...)

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

   model: An object of the class 'RtreemixModel' specifying the
          mutagenetic trees mixture model used for drawing the
          patterns, or for simulating patterns with their sampling and
          waiting times.

sampling.mode: A 'character' that specifies the sampling mode
          ("constant" or "exponential") used in the time simulations.

sampling.param: A 'numeric' that specifies the sampling parameter
          corresponding to the sampling mode given by 'sampling.mode'.

     ...: 'no.draws' is an 'integer' larger than zero specifying the
          number of patterns that should be drawn from the given
          mixture model. 'no.sim' is an 'integer' larger than 0 giving
          the number of iterations for the waiting time simulations.
          Its default value is 10. 'seed' is a positive 'integer'
          specifying the random generator seed. Its default value is
          (-1) and then the time is used as a random generator. 

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

     The function returns an 'RtreemixData' object in the case when one
     wants to draw a certain number of patterns from a given mixture
     model, i.e. when only the mutagenetic trees mixture model and the
     number of patterns to be drawn are specified. When besides the
     model also the sampling mode and the sampling parameter are given,
     the function returns an object from the 'RtreemixSim' class where
     the simulated patterns together with their sampling and waiting
     times are stored.

_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:

     'RtreemixSim-class', 'RtreemixModel-class', 'RtreemixData-class'

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

     ## Create a random RtreemixModel object with 3 branchings and 9 genetic events.
     rand.mod <- generate(K = 3, no.events = 9, noise.tree = TRUE, prob = c(0.2, 0.8))

     ## Draw 300 samples from the randomly generated model rand.mod 
     data <- sim(model = rand.mod, no.draws = 300)
     show(data)

     ## Create an RtreemixSim object by simulating patterns with their sampling and waiting times from a given mixture model.
     sim.data <- sim(model = rand.mod, sampling.mode = "exponential", sampling.param = 1, no.sim = 100)
     show(sim.data)
     WaitingTimes(sim.data)
     SamplingTimes(sim.data)

