File: dppmclass.R

package info (click to toggle)
r-cran-spatstat.core 2.4-4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,440 kB
  • sloc: ansic: 4,402; sh: 13; makefile: 5
file content (45 lines) | stat: -rw-r--r-- 1,071 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#' Methods and support for class dppm
#'
#' $Revision: 1.5 $ $Date: 2019/10/18 03:41:43 $

is.dppm <- function(x) { inherits(x, "dppm") }

plot.dppm <- function (x, ..., what = c("intensity", "statistic")){
    objectname <- short.deparse(substitute(x))
    if(missing(what) && is.stationary(x))
        what <- "statistic"
    plot.kppm(x, ..., xname = objectname, what = what)
}

Kmodel.dppm <- function (model, ...){
    Kmodel(model$fitted, W=model$window)
}

pcfmodel.dppm <- function (model, ...){
    pcfmodel(model$fitted, W=model$window)
}

intensity.dppm <- function (X, ...){
    return(intensity(X$fitted))
}

reach.dppm <- function(x, ...){
    reach(x$fitted, ...)
}

repul <- function(model, ...) {
  UseMethod("repul")
}

repul.dppm <- function(model, ...) {
  g <- pcfmodel(model)
  f <- function(x) { 2 * pi * x * (1 - g(x)) }
  rmax <- reach(model)
  h <- integrate(f, 0, rmax)$value
  lam <- intensity(model)
  ans <- h * lam
  return(ans)
}

#' print.dppm is identical to print.kppm and defined in kppm.R
#' summary.dppm is defined in summary.dppm.R