https://github.com/cran/spatstat
Raw File
Tip revision: e98e6a1ea3793d33d4e7f594b74f71e9e3c03934 authored by Adrian Baddeley on 02 March 2006, 23:18:46 UTC
version 1.8-7
Tip revision: e98e6a1
pairwise.S
#
#
#    pairwise.S
#
#    $Revision: 1.4 $	$Date: 2005/07/27 06:57:24 $
#
#    Pairwise()    create a user-defined pairwise interaction process
#                 [an object of class 'interact']
#	
# -------------------------------------------------------------------
#	

Pairwise <- function(pot, name = "user-defined pairwise interaction process",
                     par = NULL, parnames=NULL,
                     printfun) {

  fop <- names(formals(pot))
  if(!identical(all.equal(fop, c("d", "par")), TRUE)
     && !identical(all.equal(fop, c("d", "tx", "tu", "par")), TRUE))
    stop(paste("Formal arguments of pair potential function \`pot\'",
               "must be either (d, par) or (d, tx, tu, par)"))

  if(missing(printfun))
    printfun <- function(self) {
           cat(paste(self$name, "\n"))
           cat("Potential function:\n")
           print(self$pot)
         }

  out <- 
  list(
         name     = name,
         family   = pairwise.family,
         pot      = pot,
         par      = par,
         parnames = parnames,
         init     = NULL,
         update   = NULL,  
         print    = printfun
  )
  class(out) <- "interact"
  return(out)
}



back to top