Learn R Programming

capm (version 0.9.1)

SolveIASA: Modelling of immigration, abandonment, sterilization and adoption of companion animals

Description

System of ordinary differential equations to simulate the effect of immigration of owned dogs, abandonment, sterilization of owned and stray dogs and adoption, on population dynamics.

Usage

SolveIASA(pars = NULL, init = NULL, time = NULL, s.range = NULL, a.range = NULL, alpha.range = NULL, v.range = NULL, s.fm = TRUE, ...)

Arguments

pars
a named vector of length 21, with point estimates of model parameters (see details).
init
a named vector of length 8, with point estimates of model parameters (see details).
time
time sequence for which output is wanted; the first value of times must be the initial time.
s.range
optional sequence (between 0 and 1) of the sterilization rates to be simulated.
a.range
optional vector of length 2, with range (ie, confidence interval) of abandonment rates to be assessed. If given, the rates evaluated are those specified by the argument plus the point estimate given in pars.
alpha.range
optional vector of length 2, with range (ie, confidence interval) of adoption rates to be assessed. If given, the rates evaluated are those specified by the argument plus the point estimate given in pars.
v.range
optional vector of length 2, with range of values of immigration rates to be assessed. This must be expressed as a percentage of owned animals carrying capacity.
s.fm
logical. If TRUE, s.range is used for females and males and if FALSE, it is only used for females (for males, the point estimate given in pars is used.)
...
further arguments passed to ode function.

Value

list. The first element, name, is a string with the name of the function, the second element, model, is the model function. The third, fourth and fifth elements are vectors (pars, init, time, respectively) containing the pars, init and time arguments of the function. The sisxthth element results is a data.frame with up to as many rows as elements in time. The first column contain the time and subsequent columns contain the size of specific subpopulations, named according to conventions above. The group column differentiate between owned and strays. When *.range arguments are given, the last fourth columsn specify their instances.

Details

The pars argument must contain named values, using the following conventions: 1: owned animals; 2: stray animals; f: females; m: males. Then:

b1 and b2: number of births.

df1, dm1, df2 and dm2: death rate.

sf1, sm1, sf2 and sm2: sterilization rate.

k1 and k2: carrying capacity.

h1 and h2: mean harem size.

a: abandonment rate.

alpha: adoption rate.

v: immigration rate.

z: proportion of sterilized immigrants.

The init argument must contain named values for the inital number of animals, using the following conventions: 1: owned animals; 2: stray animals; f: females; m: males; and s: sterilized. Then, the names are:

f1, fs1, m1, ms1, f2, fs2, m2 and ms2.

If any range is specified (e.g s.range), the remaining ranges must be specified too (a.range, alpha.range and v.range). The function is a wrapper around the defaults of ode function, whose help page must be consulted for details. An exception is the method argument, which here has "rk4" as a default.

References

http://oswaldosantos.github.io/capm

See Also

ode.

Examples

Run this code
# Parameters and initial conditions.
pars.solve.iasa = c(
   b1 = 21871, b2 = 4374,
   df1 = 0.104, dm1 = 0.098, df2 = 0.125, dm2 = 0.118,
   sf1 = 0.069, sf2 = 0.05, sm1 = 0.028, sm2 = 0.05,
   k1 = 98050, k2 = 8055, h1 = 1, h2 = 0.5,
   a = 0.054, alpha = 0.1, v = 0.2, z = 0.1)
   
init.solve.iasa = c(
   f1 = 33425, fs1 = 10865,
   m1 = 38039, ms1 = 6808,
   f2 = 3343, fs2 = 109,
   m2 = 3804, ms2 = 68)
   

# Solve for point estimates.
solve.iasa.pt <- SolveIASA(pars = pars.solve.iasa, 
                          init = init.solve.iasa, 
                          time = 0:8, method = 'rk4')

# Solve for parameter ranges.
solve.iasa.rg <- SolveIASA(pars = pars.solve.iasa, 
                          init = init.solve.iasa, 
                          time = 0:8,
                          s.range = seq(0, .4, l = 15), 
                          a.range = c(0, .2), 
                          alpha.range = c(0, .2),
                          v.range = c(0, .1),
                          method = 'rk4')

Run the code above in your browser using DataLab