https://github.com/cran/spatstat
Raw File
Tip revision: 9cc4607b439818daec7c3705627c2d0b691977b6 authored by Adrian Baddeley on 21 June 2006, 16:37:31 UTC
version 1.9-3
Tip revision: 9cc4607
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