R: Kernel Estimate of Intensity as a Spatial Function

densityfun.ppp {spatstat.core} | R Documentation

## Kernel Estimate of Intensity as a Spatial Function

### Description

Compute a kernel estimate of intensity for a point pattern, and return the result as a function of spatial location.

### Usage

    densityfun(X, ...)

    ## S3 method for class 'ppp'
    densityfun(X, sigma = NULL, ...,
                            weights = NULL, edge = TRUE, diggle = FALSE)

### Arguments

`X` | Point pattern (object of class `"ppp"`).
`sigma` | Smoothing bandwidth, or bandwidth selection function, passed to `density.ppp`.
`...` | Additional arguments passed to `density.ppp`.
`weights` | Optional vector of weights associated with the points of `X`.
`edge,diggle` | Logical arguments controlling the edge correction. Arguments passed to `density.ppp`.

### Details

The commands `densityfun` and `density` both perform kernel estimation of the intensity of a point pattern. The difference is that `density` returns a pixel image, containing the estimated intensity values at a grid of locations, while `densityfun` returns a `function(x,y)` which can be used to compute the intensity estimate at any spatial location. For purposes such as model-fitting it is more accurate to use `densityfun`.

### Value

A `function` with arguments `x,y` returning values of the intensity. The function also belongs to the class `"densityfun"` which has methods for `print` and `as.im`. It also belongs to the class `"funxy"` which has methods for `plot`, `contour` and `persp`.

### Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

### See Also

`density`.

To interpolate values observed at the points, use `Smoothfun`.

### Examples

      f <- densityfun(swedishpines)
      f
      f(42, 60)
      plot(f)

[Package spatstat.core version 2.0-0 Index]