runif.sphwin: Generate the uniform distribution or a homogeneous Poisson...

View source: R/runif.sphwin.R

runif.sphwinR Documentation

Generate the uniform distribution or a homogeneous Poisson point pattern on the sphere

Description

Generates the uniform distribution or a random point pattern using the (homogeneous) Poisson process, on a sphere or a subset of a sphere. Includes CSR (complete spatial randomness).

Usage

runif.sphwin(n, win = sphwin(type = "sphere"), nsim=1, drop=TRUE,
 as.sp=TRUE, ndim="2")

rpoispp.sphwin(lambda, win = sphwin(type = "sphere"), lmax=NULL,
 ..., nsim=1, drop=TRUE, as.sp=TRUE, ndim="2")

Arguments

n

The number of points to be simulated. An integer.

lambda

The intensity of the point process to be simulated. A numeric of length 1 or an object of class function.

win

The window, an object of type sphwin.

lmax

A numeric of length 1 giving the maximum value of lambda, if lambda is a function.

...

Arguments passed to lambda if it is a function.

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.

as.sp

Logical. If TRUE, returns an object of class as defined by sp.dim. Otherwise, returns a matrix. See Value.

ndim

A string, taking value "2" or "3". Specifies whether the object should contain the locations of the points in spherical coordinates (ndim="2") or Cartesian coordinates (ndim="3").

Details

runif.sphwin generates a realisation of n points of the uniform distribution inside the window win (if win is an object of class sphwin).

If lambda is a single number, then rpoispp.sphwin this algorithm generates a realisation of the uniform Poisson process (also known as Complete Spatial Randomness, CSR) inside the window win with intensity lambda (points per unit area).

If lambda is a function, then rpoispp.sphwin uses the adaptation to point patterns on the sphere of Lewis and Shedler's (1979) rejection sampling algorithm. According to this algorithm, a uniform Poisson process of intensity lmax is generated, and a point at location s is retained with probability lambda(s)/lmax.

Value

If nsim=1 and drop=FALSE then a single item as described below; otherwise a list containing nsim items.

An item is determined by the values of as.sp and ndim:

If as.sp=FALSE and ndim="2", a two column matrix giving the locations of the simulated points.

If as.sp=FALSE and ndim="3", a three column matrix giving the locations of the simulated points.

If as.sp=TRUE and ndim="2", an object of class sp2 giving the locations of the simulated points.

If as.sp=TRUE and ndim="3", an object of class sp3 giving the locations of the simulated points.

Note

The function rpoispp.sphwin is the analogue for point processes on the sphere of the function rpoispp in spatstat, which is the corresponding function for point processes in R^2. Hence elements of this help page have been taken from rpoispp with the permission of A. J. Baddeley. This enables the relevant information on this help page to be consistent with that for rpoispp. It is hoped that this will minimise or remove any confusion for users of both spatstat and spherstat.

Author(s)

Tom Lawrence <email: tjlawrence@bigpond.com>

References

Lewis, P.A.W. and Shedler, G.S. (1979) Simulation of non-homogeneous Poisson processes by thinning. Naval Logistics Quarterly 26, 406–413.

See Also

rpoispp, rFisher, rHardcore.sphwin, rMatClust.sphwin, rMaternI.sphwin, rMaternII.sphwin, rStrauss.sphwin, rThomas.sphwin

Examples

sph <- sphwin(type="sphere")
rus <- runif.sphwin(n=150, win=sph, as.sp=TRUE, ndim="2")
rus

rps <- rpoispp.sphwin(win=sph, lambda=150, as.sp=TRUE, ndim="2")
rps

baddstats/spherstat documentation built on Feb. 6, 2023, 1:45 a.m.