R/pip.R

Defines functions pip

Documented in pip

#pip.R

#' pairwise invasibility plot
#'
#' for the simple branching model
#' @param SIGMA2_K the width of carrying capacity kernel
#' @param SIGMA2_C width of competitoin kernel
#' @return a pip plot
#' @export
pip <- function(SIGMA2_K = 2, SIGMA2_C = 1 ){

  K <- function(x){ exp(-x^2/(2*SIGMA2_K)) }
  C <- function(x,y){ exp(-(x-y)^2/(2*SIGMA2_C) ) }
  S_sing <- function(y,x)
  {
    1 - (K(x)*C(x,y) )/K(y) 

  }


  X <-( seq(-1, 1, length = 200) )
  Y <- X

  Sy <- function(y){ mapply(S_sing, x=X, y=y) }
  S <- sapply(Y, Sy)


  filled.contour(X, Y, S, levels=c(-1, 0, 1), col=c("white", "gray"))
}
cboettig/fluctuationDomains documentation built on Sept. 19, 2020, 9:42 p.m.