hal.point: Draws a Halton Lattice sample from a discrete (point)...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/hal.point.r

Description

Draws a Halton Lattice sample from a SpatialPoints* object.

Usage

1
hal.point(x, n, J = NULL, bases = c(2, 3))

Arguments

x

A SpatialPoints or SpatialPointsDataFrame object. This object must contain at least 1 point.

n

Sample size. Number of locations to draw from the set of points contained in x.

J

A 2X1 vector of base powers. J[1] is for horizontal, J[2] for vertical dimension. J determines the size and shape of the smallest Halton boxes. There are bases[1]^J[1] vertical columns of Halton boxes over x's bounding box, and bases[2]^J[2] horizontal rows of Halton boxes over the bounding box, for a total of prod(bases^J) boxes. The dimension of each box is c(dx,dy)/(bases^J), where c(dx,dy) are the horizontal and vertical extents of x's bounding box. If J=NULL (the default), J is chosen so that Halton boxes are as square as possible.

bases

2X1 vector of Halton bases. These must be co-prime.

Details

A brief description of Halton Lattice sampling for points: Given a set of Halton Lattice parameters J and bases, a lattice of Halton boxes is constructed over the bounding box of the input points. This results in prod(bases^J) Halton boxes on the bounding box. The Halton index of all boxes is computed and assigned to points that lie in each box. Points that lie in the same Halton box are randomly assigned unique Halton cycle numbers. This separates points in the same Halton box by at least prod(bases^J) units when indices are mapped to the real line. Finally, a random number between 1 and the largest Halton (index+cycle) is drawn, and the next n units in the mapped real numbers are taken as the sample, restarting from the beginning if necessary.

Value

A SpatialPointsDataFrame containing locations in the HAL sample, in HAL order. Attributes of the sample points are:

Additional attributes of the output object, beyond those which make it a SpatialPointsDataFrame, are:

Author(s)

Trent McDonald

See Also

hal.line, hal.polygon, sdraw, bas.point

Examples

1
2
3
4
5
6
7
8
#   Draw sample of Hawaii coastline
#   This takes approximately 30 seconds to run
data(WA.cities)
samp <- hal.point( WA.cities, 100 )

#   Different lattice topology
samp <- hal.point( WA.cities, 100, J=c(10,4))
  

SDraw documentation built on May 29, 2017, 6:14 p.m.