bas.line: Draws a Balanced Acceptance Sample (BAS) from a linear...

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

View source: R/bas.line.r


Draws a BAS sample from a SpatialLines* object.


bas.line(x, n, balance = "1D", init.n.factor = 10)



A SpatialLines or SpatialLinesDataFrame object. This object must contain at least 1 line. If it contains more than 1 line, the BAS sample is drawn from the union of all lines.


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


Option specifying how spatial balance is maintained. The options are "1D" or "2D".

Under "1D" all lines in x are stretched straight and laid end-to-end in the order they appear in x and a 1-dimensional BAS sample is taken from the amalgamated line. 1D sample locations on the amalgomated line are mapped back to two dimensional space for output and appear on the original lines. This method maintains 1D spatial balance, but not necessarily 2D balance. Spatially balanced samples in 1D may not look spatially balanced when plotted in 2 dimensions.

Under "2D" a systematic sample of points along the union of all lines in x is drawn first, and a 2-dimensional BAS sample of the points is drawn (see init.n.factor below and bas.point). This maintains 2D spatial balance of sample locations on the lines. Depending on init.n.factor, the "2D" balance option can take significantly longer to run than the "1D" option.


If balance == "2D", this is a scalar controlling the number of points to place on the lines before drawing the 2D BAS sample. Number of points created on the line is n*init.n.factor, so this number can grow quickly. On average, this is the number of unselected points between each selected point. See Details.

If one desires an underlying grid spaced w meters appart, set init.n.factor to L/(w*n), where L is total length of all lines in x and n is sample size.


If a "1D" sample is requested, spatial balance is maintained on the lines when laid end-to-end in the order they appear. Points far apart in 1 dimension may be close together in 2 dimensions, and vice versa. Thus the sample may not look spatially balanced on a 2D map. This is a true infinite sample in that any of an infinite number of points along the lines could be selected.

If a "2D" BAS sample is requested, spatial balance is maintained in 2 dimensions. Points are well balance on a 2D map. This is done by discretization of lines with a dense systematic sample of points (with random start) where density of the systematic points is controled by init.n.factor. After discretization of the line, points are selected using bas.point. The BAS method for points places a small square (pixel) around each and samples the set of squares using the BAS method for polygons (see bas.polygon). The BAS method of polygons computes Halton points until n fall inside the squares surrounding discretization points. When a Halton point falls in a square, the square is selected and the sample location is the center of the square (which falls somewhere on the original lines).


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

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


Trent McDonald

See Also

bas.line, bas.polygon, sdraw


#   Draw sample of Hawaii coastline
#   This takes approximately 60 seconds to run
samp <- bas.line( HI.coast, 50 )
points( samp, pch=16, col="red" )

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