lv                  package:simecol                  R Documentation

_L_o_t_k_a-_V_o_l_t_e_r_r_a _P_r_e_d_a_t_o_r-_P_r_e_y _M_o_d_e_l

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

     'simecol' example: basic Lotka-Volterra predator prey-model.

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

     data(lv)

_F_o_r_m_a_t:

     An S4 object according to the 'odeModel' specification. The object
     contains the following slots:


     '_m_a_i_n' Lotka-Volterra equations for predator and prey.

     '_p_a_r_m_s' Vector with the named parameters of the model:

          '_k_1' growth rate of the prey population,

          '_k_2' encounter rate of predator and prey,

          '_k_3' death rate of the predator population.


     '_t_i_m_e_s' Simulation time and integration interval.

     '_i_n_i_t' Vector with start values for predator and prey.

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

     To see all details, please have a look into the implementation.

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

     Lotka, A. J. 1925. _Elements of physical biology._ Williams and
     Wilkins, Baltimore.

     Volterra, V. (1926). Variazionie fluttuazioni del numero
     d'individui in specie animali conviventi. _Mem. Acad.Lincei_, *2*,
     31-113.

_S_e_e _A_l_s_o:

     'simecol-package', 'sim', 'parms', 'init', 'times'.

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

     ##============================================
     ## Basic Usage:
     ##   explore the example
     ##============================================
     data(lv)
     print(lv)
     plot(sim(lv))

     parms(lv) <- c(k1=0.5, k2=0.5, k3=0.5)
     plot(sim(lv))

     ##============================================
     ## Implementation:
     ##   The code of the Lotka-Volterra-model
     ##============================================
     lv <- new("odeModel",
       main = function (time, init, parms) {
         x <- init
         p <- parms
         dx1 <-   p["k1"] * x[1] - p["k2"] * x[1] * x[2]
         dx2 <- - p["k3"] * x[2] + p["k2"] * x[1] * x[2]
         list(c(dx1, dx2))
       },
       parms  = c(k1=0.2, k2=0.2, k3=0.2),
       times  = c(from=0, to=100, by=0.5),
       init   = c(prey=0.5, predator=1),
       solver = "rk4"
     )

