https://github.com/cran/spatstat
Tip revision: 59bf17bc31bd0f63ad47579b40d1c3d10e9d8a10 authored by Adrian Baddeley on 20 November 2006, 21:03:00 UTC
version 1.10-3
version 1.10-3
Tip revision: 59bf17b
geyer.S
#
#
# geyer.S
#
# $Revision: 2.4 $ $Date: 2005/03/22 02:27:09 $
#
# Geyer's saturation process
#
# Geyer() create an instance of Geyer's saturation process
# [an object of class 'interact']
#
# ------------------------------------------------------------------
# Note: if you want to imitate this, remember that 'pairsat.family'
# expects the saturation parameter 'sat' to be called $par$saturate
# in this 'interact' object.
# -------------------------------------------------------------------
#
Geyer <- function(r, sat) {
out <-
list(
name = "Geyer saturation process",
family = pairsat.family,
pot = function(d, par) {
ifelse(d <= par$r, 1, 0) # same as for Strauss
},
par = list(r = r, saturate=sat),
parnames = c("interaction distance","saturation parameter"),
init = function(self) {
r <- self$par$r
sat <- self$par$saturate
if(!is.numeric(r) || length(r) != 1 || r <= 0)
stop("interaction distance r must be a positive number")
if(!is.numeric(sat) || length(sat) != 1 || sat < 1)
stop("saturation parameter sat must be a number >= 1")
},
update = NULL, # default OK
print = NULL, # default OK
interpret = function(coeffs, self) {
loggamma <- coeffs[["Interaction"]]
gamma <- exp(loggamma)
return(list(param=list(gamma=gamma),
inames="interaction parameter gamma",
printable=round(gamma,4)))
},
valid = function(coeffs, self) {
gamma <- (self$interpret)(coeffs, self)$param$gamma
return(is.finite(gamma))
},
project = function(coeffs, self) {
gamma <- (self$interpret)(coeffs, self)$param$gamma
if(is.na(gamma))
coeffs[["Interaction"]] <- 0
else if(!is.finite(gamma))
coeffs[["Interaction"]] <-
log(.Machine$double.xmax)/self$par$saturate
return(coeffs)
},
irange = function(self, coeffs=NA, epsilon=0, ...) {
r <- self$par$r
if(any(!is.na(coeffs))) {
loggamma <- coeffs[["Interaction"]]
if(!is.na(loggamma) && (abs(loggamma) <= epsilon))
return(0)
}
return(r)
}
)
class(out) <- "interact"
out$init(out)
return(out)
}