sppatt: Create a Point Pattern on a (Subset of) a Sphere

sppattR Documentation

Create a Point Pattern on a (Subset of) a Sphere

Description

Creates an object of class "sp2" or "sp3" representing a point pattern on a (subset of) a sphere

Usage

sp2(X, win=sphwin(type="sphere"), check=TRUE)
sp3(X, win=sphwin(type="sphere"), check=TRUE)

Arguments

X

The locations of points in the pattern. sp2 requires a 2 column matrix, with locations given in spherical coordinates (see spherstat-package), sp3 requires a 3 column matrix, with locations given in Cartesian coordinates. See Details for further information on how to specify locations.

win

The observation window, an object of class sphwin.

check

If TRUE (which is the default setting), checks that all points in X are in the window defined by win. If FALSE, no checks are performed. See Details.

Details

An object of class sp2 or sp3 is the most efficient way of giving information about the locations of points on a sphere, and the window in which they are observed. Functions in this package accept objects of these types as input (even when one of the elements e.g. the locations of points, or the window, is irrelevant), they can instead accept the relevant information provided in the same way as specified above e.g. if win is specified as an object of class "sphwin". This being said, sp2 and sp3 are strongly recommended as the classes of objects given as input in this package because their creation includes a check to ensure all specified points are in win and in the required format.

For both sp2 and sp3, the locations of points (X) must be given in matrix form, with each row specifying the location of a different point. sp2 requires a 2 column matrix with locations given in spherical coordinates; the first column being colatitudes, taking values in the range [0, pi], where 0 is the ‘north pole’; the second column being longitudes, taking values in the range [0, 2*pi), where 0 is the ‘Greenwich meridian’, and the longitude is measured in an anticlockwise direction from this point.

sp3 requires a three column matrix; the first, second and third columns specifying the x, y and z coordinates of points. A check is automatically performed to ensure that distance between the centre of the sphere (assumed to be (0,0,0)), the point (x,y,z) is within 10^(-11) units of the surface of the sphere.

By default, when objects of class sp2 and sp3 are created, a check is performed to ensure that all points listed in X are within the observation window defined by win. The argument check allows the user to determine whether or not such checks occur, and was introduced to reduce the run-time of some other functions in this package. It is very strongly recommended that this argument always be set to TRUE (the default setting) since if an object of class sp2 or sp3 is created such that some points are outside the observation window, and that object is passed to other functions then either errors will be generated, or the output is likely to be invalid.

Value

A one sentence description of the window.

Author(s)

Tom Lawrence <email: tjlawrence@bigpond.com>

See Also

spherstat-package for detail on the spherical coordinate system used in this package

Examples

X <- matrix(c(1,0,0, 0,0,1, 0,1,0), nrow=3, ncol=3, byrow=TRUE)
win <- sphwin(type="sphere")
sp3(X=X, win=win)

Y <- matrix(c(0,0, pi/2, 0, pi/2, pi, pi, 0), nrow=4, ncol=2, byrow=TRUE)
sp2(X=Y, win=win)


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