sss.point: Draw a Simple Systematic Sample (SSS) from a point resource...

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

View source: R/sss.point.r

Description

Draw a systematic sample from a SpatialPoints* object or a data.frame. SpatialPoints* objects can represent point resources in 2-dimensional space, such as towns, event locations, or grid cell centers.

Usage

1
sss.point(x, n)

Arguments

x

A SpatialLines, SpatialLinesDataFrame, or data.frame object.

n

Sample size. Number of points to draw from the set of all points in x. If n exceeds the number of units (= number of rows in data.frame(x)), a census is taken (i.e., x is returned).

Details

The points in x are systematically sampled in the order they appear. That is, the sampling frame (i.e., data.frame(x)) is not re-ordered prior to sampling. Each row in the frame represents a point or sample unit, and rows are sampled systematically starting with row 1. To draw a systematic sample across the range of an attribute, say attribute y, sort x by y prior to calling this routine (e.g,. sss.point( x[order(x$y),], n )).

This routine draws fixed size systematic samples. Many systematic sampling procedure produce variable size samples. Conceptually, the sample procedure is:

  1. Each sample unit (= row of sample frame) is associated with a line segment. Assuming there are N units in the frame (N = nrow(x)), each line segment has length n/N, where n is the input desired sample size.

  2. Line segments are placed end-to-end, starting at 0, in the order in which their associated unit appears in the frame.

  3. To start the systematic sample, the routine chooses a random number between 0 and 1. Let this random number be m.

  4. The sample units associated with the line segments containing the numbers m + i for i = 0,1,...,(n-1), are selected for the sample.

Value

If input x inherits from a the SpatialPointsDataFrame class, a SpatialPointsDataFrame object containing locations in the sample is returned. If input x is a data.frame, a data.frame is returned. Attributes of the returned sample points are:

Additional attributes of the output object are:

Using these additional attributes, one could reconstruct the sample.

Author(s)

Trent McDonald

See Also

sss.polygon, sss.line, sdraw

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Draw systematic sample across range of population
WA.samp <- sss.point( WA.cities[order(WA.cities$POP_2010),], 100 )   
plot( WA.cities )
points( WA.samp, col="red", pch=16 )

# Draw systematic sample from data frame
df <- data.frame( a=1:100, b=runif(100) )
samp <- sss.point( df, 5 )   

# Equivalent to simple random sample: randomly sort frame.
samp <- sss.point( df[order(df$b),], 5 )

SDraw documentation built on July 8, 2020, 6:23 p.m.