Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

distfun.lpp

Distance Map on Linear Network


Description

Compute the distance function of a point pattern on a linear network.

Usage

## S3 method for class 'lpp'
distfun(X, ..., k=1)

Arguments

X

A point pattern on a linear network (object of class "lpp").

k

An integer. The distance to the kth nearest point will be computed.

...

Extra arguments are ignored.

Details

On a linear network L, the “geodesic distance function” of a set of points A in L is the mathematical function f such that, for any location s on L, the function value f(s) is the shortest-path distance from s to A.

The command distfun.lpp is a method for the generic command distfun for the class "lpp" of point patterns on a linear network.

If X is a point pattern on a linear network, f <- distfun(X) returns a function in the R language that represents the distance function of X. Evaluating the function f in the form v <- f(x,y), where x and y are any numeric vectors of equal length containing coordinates of spatial locations, yields the values of the distance function at these locations. More efficiently f can be called in the form v <- f(x, y, seg, tp) where seg and tp are the local coordinates on the network. It can also be called as v <- f(x) where x is a point pattern on the same linear network.

The function f obtained from f <- distfun(X) also belongs to the class "linfun". It can be printed and plotted immediately as shown in the Examples. It can be converted to a pixel image using as.linim.

Value

A function with arguments x,y and optional arguments seg,tp. It also belongs to the class "linfun" which has methods for plot, print etc.

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

To identify which point is the nearest neighbour, see nnfun.lpp.

Examples

X <- runiflpp(3, simplenet)
   f <- distfun(X)
   f
   plot(f)

   # using a distfun as a covariate in a point process model:
   Y <- runiflpp(4, simplenet)
   fit <- lppm(Y ~D, covariates=list(D=f))

   f(Y)

spatstat.linnet

Linear Networks Functionality of the 'spatstat' Family

v2.1-1
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Ottmar Cronie [ctb], Tilman Davies [ctb], Greg McSwiggan [ctb], Suman Rakshit [ctb]
Initial release
2021-03-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.