mainSimul               package:rhosp               R Documentation

_s_i_m_u_l_a_t_e _m_a_n_y _t_i_m_e_s _t_h_e _f_i_r_s_t _m_o_d_e_l _a_n_d _c_a_l_c_u_l_a_t_e _t_h_e _r_i_s_k _c_o_n_s_t_a_n_t

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

     main simulates nbBed times the first model with the function simul
     and calculates the risk constant R and CR by solving the renewal
     equation (*). this renewal equation is only valid if the Xi forms
     a poisson process. R and CR are defined such that the equivalent
     survival function is CR * exp(-R*x)

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

     mainSimul(nbBed, nbPatient, disXi, disP, toplot = FALSE, calc = TRUE)

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

   nbBed: the number of beds 

nbPatient: the number of patient in each bed  

   disXi: the distribution of the variable Xi : disXi is a 3 elements
          list : rangen <=>  a random positive variable generator ;
          nbparam <=> number of parameter of this distribution and
          param <=> a list of parameters 

    disP: the "distribution" of the success probability of Zi : p :
          disP is a 3 elements list : disfun <=> a distribution
          function ; nbparam <=> number of parameter of this
          distribution and param <=> a list of parameters 

  toplot: a logical variable to plot the variable Zi

    calc: should the risk constants calculate? 

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

     return a list of the following components

_T  T the vector of durations between two declared side effects

_R  R a risk constant

_C_R CR a risk constant

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

     Describe the value returned If it is a LIST, use 

  comp1 : Description of 'comp1'

  comp2 : Description of 'comp2'

     ...

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

     CJ

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

     arg1Exp<-list(rangen=rexp,nbparam=1,param=list(1/3));
     arg1Bin<-list(rangen=rbinom,nbparam=2,param=list(1,1/20));
     arg1Unif<-list(rangen=runif,nbparam=2,param=list(0,20));
     arg1Lnorm<-list(rangen=rlnorm,nbparam=2,param=list(1/4,1));

     arg2Exp<-list(disfun=pexp,nbparam=1,param=list(1/5));
     arg2Cst<-list(disfun=pcst<-function(x,p) p ,nbparam=1,param=list(1/3));
     arg2Comp<-list(disfun=pcomp<-function(x,mu1,mu2,mu3){1-1/3*exp(-mu1* x)-1/2*exp(-mu2 *x)-1/6*exp(-mu3 *x)}
     ,nbparam=3,param=list(1/3,1/5,1/10));
     arg2Gamma<-list(disfun=pgamma,nbparam=2,param=list(3,1/3));
     arg2Lnorm<-list(disfun=plnorm,nbparam=2,param=list(1/20,2));

     T<-mainSimul(100,100,arg1Exp,arg2Exp)

