R/Ex1.R

Defines functions Ex Ex1

# function to calculate extinction when predation changes
source('R/PatchDDstoch.R')
Ex = function(p, pred2) {
  Runmat = PatchDDstoch(p, M, states, fx, n0, npatch, nstg, tf=500, P, pred=pred2)[1,]
  if (Runmat[500]==0) ex = 1 else ex = 0
  return(ex)
}


# function to calculate extinction when environmental states change
Ex1 = function(p, states1) {
  # set the seed so the curve is smoother (Sebastian told me to)
  Runmat = PatchDDstoch(p, M, states=states1, fx, n0, npatch, nstg, tf=500, P, pred)[1,]
  if (Runmat[500]==0) ex = 1 else ex = 0
  return(ex)
}
rosehartman/frog-trap documentation built on May 27, 2019, 11:31 p.m.