rdrm                   package:drc                   R Documentation

_S_i_m_u_l_a_t_i_n_g _a _d_o_s_e-_r_e_s_p_o_n_s_e _c_u_r_v_e

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

     Simulation of a dose-response curve with user-specified dose
     values and error distribution.

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

       rdrm(nosim, fct, mpar, xerror, xpar = 1, yerror = "rnorm", ypar = c(0, 1), 
       onlyY = FALSE)

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

   nosim: numeric. The number of simulated curves to be returned.

     fct: list. Any built-in function in the package _drc_ or a list
          with similar components.

    mpar: numeric. The model parameters to be supplied to 'fct'.

  xerror: numeric or character. The distribution for the dose values.

    xpar: numeric vector supplying the parameter values defining the
          distribution for the dose values.  If 'xerror' is a
          distribution then remember that the number of dose values
          also is part of this argument  (the first argument).

  yerror: numeric or character. The error distribution for the response
          values.

    ypar: numeric vector supplying the parameter values defining the
          error distribution for the  response values.

   onlyY: logical. If TRUE then only the response values are returned
          (useful in simulations).  Otherwise both dose values and
          response values (and for binomial data also the weights) are
          returned.

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

     The distribution for the dose values can either be a fixed set of
     dose values (a numeric vector) used repeatedly for creating all
     curves or be a distribution specified as a character string
     resulting in varying dose values from curve to curve.

     The error distribution for the response values can be any
     continuous distribution like 'rnorm' or 'rgamma'. Alternatively it
     can be the binomial distribution  'rbinom'.

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

     A list with up to 3 components (depending on the value of the
     'onlyY' argument).

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

     Christian Ritz

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

     ~put references to the literature/web site here ~

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

     ## Simulating normally distributed dose-response data

     ## Model fit to simulate from
     ryegrass.m1 <- drm(rootl~conc, data = ryegrass, fct = LL.4())

     ## 10 random dose-response curves based on the model fit
     sim10a <- rdrm(10, LL.4(), coef(ryegrass.m1), xerror = ryegrass$conc)
     sim10a

     ## Simulating binomial dose-response data

     ## Model fit to simulate from
     deguelin.m1 <- drm(r/n~dose, weights=n, data=deguelin, fct=LL.2(), type="binomial")

     ## 10 random dose-response curves
     sim10b <- rdrm(10, LL.2(), coef(deguelin.m1), deguelin$dose, yerror="rbinom", ypar=deguelin$n)
     sim10b

