Learn R Programming

⚠️There's a newer version (5.5.1) of this package.Take me there.

spsurvey

spsurvey is an R package that implements a design-based approach to statistical inference, with a focus on spatial data. Spatially balanced samples are selected using the Generalized Random Tessellation Stratified (GRTS) algorithm. The GRTS algorithm can be applied to finite resources (point geometries) and infinite resources (linear / linestring and areal / polygon geometries) and flexibly accommodates a diverse set of sampling design features, including stratification, unequal inclusion probabilities, proportional (to size) inclusion probabilities, legacy (historical) sites, a minimum distance between sites, and two options for replacement sites (reverse hierarchical order and nearest neighbor). Data are analyzed using a wide range of analysis functions that perform categorical variable analysis, continuous variable analysis, attributable risk analysis, risk difference analysis, relative risk analysis, change analysis, and trend analysis. spsurvey can also be used to summarize objects, visualize objects, select samples that are not spatially balanced, select panel samples, measure the amount of spatial balance in a sample, adjust design weights, and more.

Installation

You can install and load the most recent approved version from CRAN by running

# install the most recent approved version from CRAN
install.packages("spsurvey")
# load the most recent approved version from CRAN
library(spsurvey)

You can install and load the most recent development version ofspsurvey from GitHub by running:

# Installing from GitHub requires you first install the remotes package
install.packages("remotes")

# install the most recent development version from GitHub
remotes::install_github("USEPA/spsurvey", ref = "main")
# load the most recent development version from GitHub
library(spsurvey)

You can install the most recent development version of spsurvey from GitHub with package vignettes by running:

install the most recent development version from GitHub with package vignettes
devtools::install_github("USEPA/spsurvey", build_vignettes=TRUE)

To view the vignettes in RStudio, run

vignette("start-here", "spsurvey") # start with this vignette for an spsurvey overview
vignette("EDA", "spsurvey") # for summaries and visualizations (exploratory data analysis)
vignette("sampling", "spsurvey") # for spatially balanced sampling
vignette("analysis", "spsurvey") # for analyzing data

To view the vignettes in a web format, visit here.

Further detail regarding spsurvey is contained in the package's documentation manual available for download here.

Citation

If you used spsurvey in your work, please cite it. You can view the most recent citation by running

citation(package = "spsurvey")
#> To cite the spsurvey package in publications use:
#> 
#>   Dumelle, Michael., Kincaid, T. M., Olsen, A. R., and Weber, M. H. (2022). spsurvey:
#>   Spatial Sampling Design and Analysis. R package version 5.3.0.
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Manual{,
#>     title = {spsurvey: Spatial Sampling Design and Analysis},
#>     author = {Michael Dumelle and Thomas M. Kincaid and Anthony R. Olsen and Marc H. Weber},
#>     year = {2022},
#>     note = {R package version 5.3.0},
#>   }

Package Contributions

We encourage users to submit issues and enhancement requests so we may continue to improve spsurvey.

EPA Disclaimer

The United States Environmental Protection Agency (EPA) GitHub project code is provided on an "as is" basis and the user assumes responsibility for its use. EPA has relinquished control of the information and no longer has responsibility to protect the integrity , confidentiality, or availability of the information. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by EPA. The EPA seal and logo shall not be used in any manner to imply endorsement of any commercial product or activity by EPA or the United States Government.

License

This project is licensed under the GNU General Public License, GPL-3.

Copy Link

Version

Install

install.packages('spsurvey')

Monthly Downloads

601

Version

5.3.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Michael Dumelle

Last Published

February 25th, 2022

Functions in spsurvey (5.3.0)

NE_Lakes_df

New England Lakes data (as a data frame)
cont_cdfplot

Create a PDF file containing cumulative distribution functions (CDF) plots
cont_analysis

Continuous variable analysis
Illinois_River_Legacy

Illinois River legacy data
ash1_wgt

Compute the average shifted histogram (ASH) for one-dimensional weighted data
cont_cdftest

Cumulative distribution function (CDF) inference for a probability survey
adjwgt

Adjust survey design weights by categories
cov_panel_dsgn

Create a covariance matrix for a panel design
NE_Lakes

New England Lakes data
Lake_Ontario

Lake Ontario data
revisit_rand

Create a revisit design with random assignment to panels and time periods
cdf_plot

Plot a cumulative distribution function (CDF)
revisit_dsgn

Create a panel revisit design
grts

Select a generalized random tessellation stratified (GRTS) sample
errorprnt

Print errors from analysis functions
diffrisk_analysis

Risk difference analysis
irs

Select an independent random sample (IRS)
NRSA_EPA7

NRSA EPA7 data
NLA_PNW

NLA PNW data
spsurvey-package

spsurvey: Spatial Sampling Design and Analysis
localmean_weight

Internal Function: Local Mean Variance Neighbors and Weights
power_dsgn

Power calculation for multiple panel designs
pd_summary

Summary characteristics of a panel revisit design
warnprnt

Print grts(), irs()), and analysis function warnings
change_analysis

Change analysis
trend_analysis

Trend analysis
relrisk_analysis

Relative risk analysis
stopprnt

Print grts() and irs() errors.
ppd_plot

Plot power curves for panel designs
revisit_bibd

Create a balanced incomplete block panel revisit design
attrisk_analysis

Attributable risk analysis
cat_analysis

Categorical variable analysis
localmean_cov

Internal Function: Variance-Covariance Matrix Based on Local Mean Estimator
localmean_var

Internal Function: Local Mean Variance Estimator
sp_balance

Calculate spatial balance metrics
sp_plot

Plot sampling frames, design sites, and analysis data.
sp_rbind

Combine rows from GRTS or IRS samples.
sp_summary

Summarize sampling frames, design sites, and analysis data.
NE_Lakes_Legacy

New England Lakes legacy data
Illinois_River

Illinois River data