equi.GUI: Graphic User Interface (GUI) for selection of equi-probable...

Description Usage Details Value Required Inputs Optional Inputs Dialog Buttons Author(s) References See Also Examples

Description

Initiates a dialog box via a GUI to select equi-probable samples from 2-D resources.

Usage

1

Details

This routine is intended to be called from the SDrawNPS menu, but it can also be called from the command line in non-interactive environments, such as RStudio. This routine uses the RGtk2 package windowing capabilities to construct a pop-up dialog box, or GUI. In the dialog box, users specify at least the required input parameters, then press the ‘Run’ button to draw the sample.

On submission, the GUI internally packages its inputs, processes the necessary shapefile, and executes the spsurvey-package grts function. All SDrawNPS GUI submissions utilizing the GRTS sampling methodology lead to the creation of a text-based log file, which records all code utilized. The log file thus serves as a historical record containing sampling information, including the random seed utilized. It also serves as a tool for enhancing methodological understanding.

See ‘References’ for additional resources.

Value

A SpatialDesign (see the spsurvey package) object with the name specified by the user in the GUI's Sample's R name box. This object contains the sampling design specifications, the selected sample points in GRTS order, coordinates, and projection information. Sample objects are stored in the current workspace, while any export files, including a txt log of the commands utilized to generate the sample, are saved to the file directory specified via getwd.

Any maps drawn during the sampling process must be saved before R is closed. See dev.copy, jpg, and other graphics device functions.

Required Inputs

  1. Select GRTS as the Sample Type in the top drop-down list. The other sampling types are not currently available.

  2. Specify sample size in the ‘Sample Size (n)’ box.

  3. Specify the shapefile or SpatialPoints*, SpatialLines*, or SpatialPolygons* package-sp object that constitutes the sample frame in the Shapefile box, or click ‘Browse’ to browse for a shapefile with a .shp extension. When specifying the name of a shapefile via use of the input box, do not include the .shp extension and recognize that all files associated with the shapefile must reside in the current working directory, i.e., the one returned by getwd. Following selection of a spatial object or shapefile, click the ‘Inspect Frame’ button to plot it and list variables associated with its attribute data. This is a good way to determine the study area boundary.

  4. Specify the sample's R object name. The output will be a SpatialDesign object created via the spsurvey package, and contains the sampling design specifications and selected sample points in GRTS order, along with spatial coordinates and projection information.

Optional Inputs

  1. The number of oversample points, as encompassed via the ‘Over sample, each strata’ box, can be specified within each stratum. Oversample points are listed after the main sample points in the GRTS design file, i.e., the resulting sample R output object. They can also be identified in the ‘panel’ variable of the sample output. Apply caution when specifying oversample points, as large oversamples can cause samples to tend toward a proportional-to-size allocation even when other allocations are specified.

  2. The ‘Random number seed.’ When specified, the seed may be used to recreate the sample. When not specified, i.e., the box is left blank, a random seed is selected against the current time. See set.seed. In both cases, the seed ultimately utilized is recorded in both the resulting log text file and R Console. Recording the seed allows for the easy redrawing of samples if lost, or if more sites are needed. Any integer value is acceptable as the random number seed.

Dialog Buttons

  1. ‘Run.’ After specifying all required and optional inputs, the ‘Run’ button draws the sample. The .GlobalEnv workspace holds the resulting SpatialDesign object with the name specified via the GUI Sample's R name box. A confirmation dialog appears following completion of the draw. Large samples may require several tens of minutes for completion.

  2. ‘Plot Sample.’ Following sampling, the ‘Plot Sample’ button displays the sampled points on the sampling frame.

  3. ‘Tabulate Sample.’ Following sampling, display the GRTS design file in a tabular format. The GRTS design file contains information on each sampled unit, such as coordinates, and design variables, e.g., stratum or multi-density category. It also contains design weights.

  4. ‘Export.’ Following sampling, the ‘Export’ button prompts the user to save sampling results via a pop-up dialog box. The sample can be exported as an ArcGIS shapefile (.SHP); Comma Separated (.CSV); Google Earth (.KML); or Garmin format (.GPX) file.

    Shapefiles actually consist of several files with different extensions. Because of this, do not include the .SHP extension in the Name field of the pop-up when exporting to a shapefile.

  5. ‘Done.’ Dismisses the GUI dialog box, leaving any sample objects in the .GlobalEnv workspace.

Author(s)

Trent McDonald (tmcdonald@west-inc.com)

References

Stevens, D. L. and A. R. Olsen (2004). Spatially balanced sampling of natural resources. Journal of the American Statistical Association 99, 262-278.

Kincaid, T. (2015). GRTS Survey Designs for an Area Resource. Accessed online May 6, 2016. https://cran.r-project.org/web/packages/spsurvey/vignettes/Area_Design.pdf.

Starcevich L. A., DiDonato G., McDonald T., Mitchell, J. (2016). A GRTS User's Manual for the SDrawNPS Package: A graphical user interface for Generalized Random Tessellation Stratified (GRTS) sampling and estimation. National Park Service, U.S. Department of the Interior. Natural Resource Report NPS/XXXX/NRR—20XX/XXX.

See Also

spsurvey::grts

Examples

1
2
# Open a GUI for equi-probable GRTS sampling.
equi.GUI()

tmcd82070/SDrawNPS documentation built on May 31, 2019, 4:37 p.m.