rundeb: rundeb

View source: R/rundeb.R

rundebR Documentation

rundeb

Description

Function to simulate the development, growth and reproduction trajectory of an organism using DEB theory, drawing parameters from the 'AmP' parameter database at https://github.com/add-my-pet/AmPtool. It requires the 'allStat.mat' file to have been converted to 'allStat.Rda' via the R.matlab package (i.e. allStat <- readMat('allStat.mat' then save(allStat, file = 'allstat.Rda'))).

Usage

rundeb(
  allstat = allstat,
  species = "Daphnia.magna",
  Euler = 0,
  start.stage = 0,
  stages = 6,
  S_instar = rep(1.618, stages),
  ndays = 50,
  div = 24,
  starve_mode = 1,
  Tbs = rep(20, ndays * div),
  Xs = rep(100, ndays * div),
  E_sm = 350,
  fdry = 0.3,
  clutchsize = 5,
  kap.mult = 1,
  z.mult = 1,
  v.mult = 1,
  p.M.mult = 1,
  E.0.mult = 1,
  plot = 1,
  mass.unit = "g",
  length.unit = "cm",
  ageing = 1
)

Arguments

allstat

= allstat, the allstat data set

species

= 'Daphnia.magna', a species in the allstat file

Euler

= 0, use Euler integration? (faster, but less accurate), 0 or 1

start.stage

= 0, stage at which simulation starts, 0=embryo, 1=birth, 2=puberty

stages

= 6, how many life cycle stages? (e.g. 6 for a abp insect model), #

S_instar

= rep(1.618, stages), 'stress' factor determining body lengths at which molts occur (for abp insect model), -

ndays

= 50, days to run the simulation for

div

= 24, value to divide the default step size (days) by, which determines output frequency (and integration frequency if Euler = 1)

Tbs

= rep(20, ndays*div), vector of body temperatures for each time step, °C

Xs

= rep(100, ndays*div), vector of food densities,J/cm2 or J/cm3

E_sm

= 350, maximum stomach energy density per structure, J/cm3

fdry

= 0.3, dry fraction of food, -

clutchsize

= 5, eggs in a clutch, #

kap.mult

= 1, multiplier on original value for kappa, -

z.mult

= 1, multiplier on original value of z, to explore implications of DEB covariation rules for body size scaling, -

v.mult

= 1, multiplier on original value of energy conductance, v, -

p.M.mult

= 1, multiplier on original value of somatic maintenance p.M, -

E.0.mult

= 1, multiplier on original value of egg energy E.0, -

plot

= 1, produce example plots? 0=no, 1=yes

mass.unit

= 'g', mass unit for the plots, 'mg', 'g' or 'kg'

length.unit

= 'cm', length unit for the plots, 'mm', 'cm' or 'm'

ageing

= 1, impose ageing? 0=immortal, 1=aging according to parameter h.a

Examples

#library(R.matlab)
#allStat<-readMat('allStat.mat') # this will take a few minutes
#save(allStat, file = 'allstat.Rda') # save it as an R data file for faster future loading
load('allStat.Rda')
species <- "Daphnia.magna" # must be in the AmP collection - see allDEB.species list
Euler <- 0 # use Euler integration (faster but less accurate) (1) or deSolve's ODE solve (0)
start.stage <- 0 # stage in life cycle to start (0 = egg, 1 = juvenile, 2 = puberty)
ndays <- 50 # number days to run the simulation for
div <- 24 # time step divider (1 = days, 24 = hours, etc.) - keep small if using Euler method for integration
starve_mode <- 1 # Determines how reproduction buffer is used during starvation, where 0 means it is not used, 1 means it is used before structure is mobilised and 2 means it is used to maximise reserve density
Tbs <- rep(20, ndays * div) # deg C, body temperature
starvetime <- 0 # length of low food period when simulating starvation
X <- 100 # J/cm2 base food density
Xs <- c(rep(X, ndays * div/2), rep(0.000005, starvetime), rep(X, ndays * div/2-starvetime + 1)) # body temperature
E_sm <- 350 # J/cm3, volume-specific stomach energy
fdry <- 0.3 # J/cm3, volume-specific stomach energy
clutchsize <- 50 # -, clutch size
kap.mult <- 1 # -, factor to multiply kappa by (caps at 1)
p.M.mult <- 1 # -, factor to multiply p.M by (caps at 1)
v.mult <- 1 # -, factor to multiply energy conductance by
z.mult <- 1 # -, factor to multiply zoom factor by
E.0.mult <- 1 # -, factor by which to multiply initial egg energy
plot <- 1 # plot results?
mass.unit <- 'g'
length.unit <- 'mm'

deb <- rundeb(species = species, ndays = ndays, div = div, starve_mode = starve.mode, Tbs = Tbs,
              clutchsize = clutchsize, kap.mult = kap.mult, v.mult = v.mult,
              p.M.mult = p.M.mult, Xs = Xs, z.mult = z.mult, E.0.mult = E.0.mult,
              mass.unit = mass.unit, length.unit = length.unit, start.stage = start.stage,
              E_sm = E_sm, Euler = Euler, plot = plot)

debout <- as.data.frame(deb$debout) # retrieve the output
parameters <- deb$pars # retrieve the extracted parameters

mrke/NicheMapR documentation built on April 3, 2024, 10:05 a.m.