Learn R Programming

spsurvey (version 4.1.4)

spbalance: Calculate Spatial Balance Metrics for a Survey Design

Description

This function calculates spatial balance metrics for a survey design. Two options for calculation of spatial balance metrics are available: (1) use proportions obtained from the intersection of Dirichlet tesselation polygons for the sample points with the frame object and (2) use proportions obtained from a rectangular grid superimposed on the sample points and the frame object. In both cases the proportions are used to calculate the spatial balance metrics. Two metrics are calculated: (1) the Pielou evenness measure and (2) the chi-square statistic.

Usage

spbalance(spsample, sfframe, tess_ind = TRUE, sbc_ind = FALSE,
  nrows = 5, dxdy = TRUE)

Arguments

spsample

Object of class SpatialDesign produced by either the grts or irs functions that contains survey design information and additional attribute (auxiliary) variables.

sfframe

An object of class sf that contains the survey frame.

tess_ind

Logical variable indicating whether spatial balance metrics are calculated using proportions obtained from the intersection of Dirichlet tesselation polygons for the sample points with the frame object. TRUE means calculate the metrics. FALSE means do not calculate the metrics. The default is TRUE.

sbc_ind

Logical variable indicating whether spatial balance metrics are calculated using proportions obtained from a rectangular grid superimposed on the sample points and the frame. TRUE means calculate the metrics. FALSE means do not calculate the metrics. The default is FALSE.

nrows

Number of rows (and columns) for the grid of cells. The default is 5.

dxdy

Indicator for equal x-coordinate and y-coordinate grid cell increments, where TRUE means the increments are equal and FALSE means the increments are not equal. The default is TRUE.

Value

List containing the following components:

tess

results for spatial balance metrics using tesselation polygons

sbc

results for spatial balance metrics using a rectangular grid

If either the tess_ind or sbc_ind arguments are set to FALSE, the corresponding component in the list is set to NULL. Otherwise, each components of the list is a lists that contains the following components:

J_subp

Pielou evenness measure

chi_sq

Chi-square statistic

extent

frame extent for each Dirichlet tesselation polygon or rectangular grid cell

prop

frame proportion for each Dirichlet tesselation polygon or rectangular grid cell

Other Functions Required

deldir

deldir package function that computes the Delaunay triangulation and Dirichlet tesselation of a set of points

tile.list

deldir package function that extracts coordinates of the Dirichlet tesselation polygons from the object produced by the deldir function

gIntersection

rgeos package function that determines the intersection between two sp package objects

LinesLength

sp package function that determines length of the line segemnts in a class Lines object

sbcframe

function to calculate spatial balance grid cell extent and proportions for a sample frame

sbcsamp

function to calculate spatial balance grid cell extent and proportions for a survey design

Examples

Run this code
# NOT RUN {
design <- list(
  Stratum1=list(panel=c(PanelOne=50), seltype="Equal", over=10),
  Stratum2=list(panel=c(PanelOne=50, PanelTwo=50), seltype="Unequal",
    caty.n=c(CatyOne=25, CatyTwo=25, CatyThree=25, CatyFour=25), over=75))
samp <- grts(design=design, DesignID="Test.Site", type.frame="area",
  src.frame="shapefile", in.shape="shapefile.shp", stratum="stratum",
  mdcaty="mdcaty", shapefile=TRUE, out.shape="sample.shp")
sframe <- read.shp("shapefile.shp")
spbalance(samp, sframe, sbc_ind = TRUE)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab