rdiffuse: Perturb the Points in a Point Pattern According to a...

View source: R/rdiffuse.R

rdiffuseR Documentation

Perturb the Points in a Point Pattern According to a Diffusion Process

Description

Given a spatial point pattern inside a window, allow each point of the pattern to undergo random spatial diffusion inside the window for a specified amount of time, and return the final position of each point.

Usage

rdiffuse(X, sigma, ...)

## S3 method for class 'ppp'
rdiffuse(X, sigma, ..., nsim=1, drop=TRUE,
    connect = 8, method = c("C", "interpreted"), unround = TRUE)

Arguments

X

Point pattern (object of class "ppp") specifying the initial position of each point.

sigma

Equivalent standard deviation of the final position of each point, if the window were unbounded. A single positive number, or a pixel image.

...

Arguments passed to as.mask controlling the spatial resolution.

nsim

Number of simulated realisations to be generated.

drop

Logical. If nsim=1 and drop=TRUE (the default), the result will be a point pattern, rather than a list containing a point pattern.

connect

Pixel grid connectivity (4 or 8).

method

For testing purposes only. Character string (partially matched) specifying whether to use a C language implementation or an interpreted R implementation.

unround

Logical value specifying whether the final positions of the points should be altered slightly by adding a small random error to the coordinates using rUnround. This reverses the effect of the discretisation. If unround=FALSE, all the final positions are exactly at the centre of a pixel.

Details

The spatial locations of the points of X are first discretised onto a pixel grid, with resolution specified by the arguments .... Each point then executes a random walk on the pixel grid, independently of other points. The final location of each point is returned.

Value

A point pattern or a list of point patterns. Each point pattern has the same window as X and the same number of points as X.

Author(s)

\adrian

.

See Also

densityHeat.ppp

Examples

  plot(solist(original=cells, diffused=rdiffuse(cells, 0.05)))

spatstat.random documentation built on May 24, 2026, 9:07 a.m.