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

rlpp

Random Points on a Linear Network


Description

Generates n independent random points on a linear network with a specified probability density.

Usage

rlpp(n, f, ..., nsim=1, drop=TRUE)

Arguments

n

Number of random points to generate. A nonnegative integer giving the number of points, or an integer vector giving the numbers of points of each type.

f

Probability density (not necessarily normalised). A pixel image on a linear network (object of class "linim") or a function on a linear network (object of class "linfun"). Alternatively, f can be a list of functions or pixel images, giving the densities of points of each type.

...

Additional arguments passed to f if it is a function or a list of functions.

nsim

Number of simulated realisations to generate.

drop

Logical value indicating what to do when nsim=1. If drop=TRUE (the default), the result is a point pattern. If drop=FALSE, the result is a list with one entry which is a point pattern.

Details

The linear network L, on which the points will be generated, is determined by the argument f.

If f is a function, it is converted to a pixel image on the linear network, using any additional function arguments ....

If n is a single integer and f is a function or pixel image, then independent random points are generated on L with probability density proportional to f.

If n is an integer vector and f is a list of functions or pixel images, where n and f have the same length, then independent random points of several types are generated on L, with n[i] points of type i having probability density proportional to f[[i]].

Value

If nsim = 1 and drop=TRUE, a point pattern on the linear network, i.e.\ an object of class "lpp". Otherwise, a list of such point patterns.

Author(s)

See Also

Examples

g <- function(x, y, seg, tp) { exp(x + 3*y) }
  f <- linfun(g, simplenet)

  rlpp(20, f)

  plot(rlpp(20, f, nsim=3))

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.