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)

