R/clusterfunctions.R

Defines functions clusterradius.kppm clusterfield.kppm clusterkernel.kppm

Documented in clusterfield.kppm clusterkernel.kppm clusterradius.kppm

## clusterfunctions.R
##
## Contains methods for the generic functions
##  - clusterkernel
##  - clusterfield
##  - clusterradius.
##
##   $Revision: 1.13 $  $Date: 2023/06/09 05:13:54 $
##

## The generic clusterkernel() is now in spatstat.random
## The method clusterkernel.character is now in spatstat.random

clusterkernel.kppm <- function(model, ...) {
  kernelR <- Kpcf.kppm(model, what = "kernel")
  f <- function(x, y = 0, ...){
    kernelR(sqrt(x^2+y^2))
  }
  return(f)
}

## The generic clusterfield() is now in spatstat.random
## The method clusterfield.character is now in spatstat.random
## The method clusterfield.function is now in spatstat.random

clusterfield.kppm <- function(model, locations = NULL, ...) {
    f <- clusterkernel(model)
    if(is.null(locations)){
        if(!is.stationary(model))
            stop("The model is non-stationary. The argument ",
                 sQuote("locations"), " must be given.")
        locations <- centroid.owin(Window(model), as.ppp = TRUE)
    }
    clusterfield.function(f, locations, ..., mu = model$mu)
}

## The generic clusterradius is now defined in spatstat.random
## The method clusterradius.character is now defined in spatstat.random

clusterradius.kppm <- function(model, ..., thresh = NULL, precision = FALSE){
    a <- list(model = model$clusters,
              thresh = thresh,
              precision = precision)
    a <- append(a, as.list(c(model$clustpar, model$clustargs)))
    do.call(clusterradius.character, a)
}

Try the spatstat.model package in your browser

Any scripts or data that you put into this service are public.

spatstat.model documentation built on May 29, 2024, 2:42 a.m.