https://github.com/cran/spatstat
Raw File
Tip revision: 5380692d89c0728c413d9b9fd1103c2b65bfc205 authored by Adrian Baddeley on 28 July 2005, 23:03:00 UTC
version 1.7-11
Tip revision: 5380692
reach.R
#
#   reach.R
#
#  $Revision: 1.2 $   $Date: 2005/03/15 20:01:15 $
#

reach <- function(x, ...) {
  UseMethod("reach")
}

reach.interact <- function(x, ...) {
  verifyclass(x, "interact")
  irange <- x$irange
  if(is.null(irange))
    return(Inf)
  if(!is.function(irange))
    stop("Internal error - x$irange is not a function")
  ir <- irange(x)
  if(is.na(ir))
    ir <- Inf
  return(ir)
}

reach.ppm <- function(x, ..., epsilon=0) {
  verifyclass(x, "ppm")
  coeffs <- coef(x)
  inte <- x$interaction
  # Poisson case
  if(is.null(inte))
    return(0)
  irange <- inte$irange
  if(is.null(irange))
    return(NA)
  if(!is.function(irange))
    stop("Internal error - x$interaction$irange is not a function")
  ir <- irange(inte, coeffs=coeffs, epsilon=epsilon)
  if(is.na(ir))
    ir <- Inf
  return(ir)
}

  
  
back to top