strip.wrap: Fit the distance sampling model provided by the Distance...

Description Usage Arguments Details Value Author References Examples

View source: R/strip.wrap.R

Description

This function fits the distance sampling model provided by the Distance program using its MCDS engine.

Usage

1
2
3
4
5
6
7
strip.wrap(dataset, path, pathMCDS, SMP_LABEL = "SMP_LABEL",
  SMP_EFFORT = "SMP_EFFORT", SIZE = "SIZE", STR_LABEL = "STR_LABEL",
  STR_AREA = "STR_AREA", Type = NULL, units = list(Distance = "Perp",
  Length_units = "Kilometer", Distance_units = "Meter", Area_units =
  "Square kilometer"), breaks = c(0, 300), lsub = NULL,
  stratum = NULL, split = TRUE, period = NULL, detection = "All",
  multiplier = 2, empty = NULL, verbose = FALSE)

Arguments

dataset

A data.frame with observations.

path

The path where to store the input and output files of the MCDS engine.

pathMCDS

The path where the MCDS engine is located.

SMP_LABEL

Name of the column to use for the transect/watch label.

SMP_EFFORT

Length in km of the transect or the transect/watch unit.

SIZE

Number of individuals in the observation.

STR_LABEL

Name of the column to use as a stratum label.

STR_AREA

Name of the column to use for the stratum area.

Type

Name of the type of transects (Line, Point, or Cue)

units

list of th units used for the analysis. Contains the Distance engine to use (Perp or Radial), the Length units, the Distance units, and the Area_units.For the possible units of distance and area see Distance 6.2 documentation.

breaks

Interval in meters to be used in the analysis.

lsub

A named list giving the subsets to be used in the analysis. The names of the list are the names of columns used to subset the dataset. Each element of the list is a vector giving the values to keep in the analysis for a given column. When a vector is NULL, all values are kept for this column. Default value lsub = NULL. See examples for further details.

stratum

When stratum = "STR_LABEL", the model will be stratified with the label. When stratum is the name of a column in the data, the model will be post-stratified according to this column (see Thomas et al. 2010). Default value is NULL.

split

When split = TRUE, separate models are ran according to the subsets determined by lsub. Default value FALSE.

period

A vector of characters of length 2 containing the extreme dates for which the analysis should be restricted. Dates have to be in the "yyyy-mm-dd" format.

detection

Currently, set to detection = "All". Can also be detection = "Stratum".

multiplier

Value by which the estimates of density or abundance are multiplied. Default value multiplier = 2 meaning only one-half of the transect is surveyed.

empty

Determine how empty transects are to be selected in the analysis. When empty = NULL, all empty transects are included for every element of lsub. For example, when models are splitted according to species, empty transects and transects where a species was not detected need to be considered in the analysis for that species. When lsub contains geographic or temporal elements, empty transects need to be restricted to the subsets given. In this case, a vector of character has to be given with the names in lsub for which the empty transects are to be restricted. When split = TRUE and empty != NULL, empty transects will be splitted according to the names in empty. In any case, it is assumed that the dataset contains at least a line for every transect executed, either with or without an observation. See examples for further details.

verbose

When set to TRUE, prints the input file given to the MCDS engine. Default value FALSE.

Details

Uses the MCDS engine from program Distance. The function produces an input file and submits it to the MCDS engine through the system function. The results are then extracted from the output files and returned as a list object.

Value

An object of class "distanceFit", when split = FALSE. When split = TRUE and lsub != NULL, a named list with the different models of class "distanceFit". Each object of class "distanceFit" is a named list with components model_fitting, parameter_estimates, chi_square_test, density_estimate, detection and path. Elements of the list are accessible through the $ operator. For each component except detection and path, a list of length 2 is given with component "Global" and "Stratum". Depending on the analysis chosen, one of these component will be empty (NULL).

Author

Francois Rousseu, Christian Roy, Francois Bolduc

References

Thomas, L., S.T. Buckland, E.A. Rexstad, J. L. Laake, S. Strindberg, S. L. Hedley, J. R.B. Bishop, T. A. Marques, and K. P. Burnham. 2010. Distance software: design and analysis of distance sampling surveys for estimating population size. Journal of Applied Ecology 47: 5-14. DOI: 10.1111/j.1365-2664.2009.01737.x

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
########################################
### Simple models without stratification
### Import and filter data
data(alcidae)
alcids <- distance.filter(alcidae, transect.id = "WatchID", distance.field = "Distance", distance.labels = c("A", "B", "C", "D"), 
                         distance.midpoints = c(25, 75, 150, 250), effort.field = "WatchLenKm", lat.field = "LatStart", 
                         long.field = "LongStart", sp.field = "Alpha", date.field = "Date") 

### Run analysis with the MCDS engine. Here, the WatchID is used as the sample.
strip.out1 <-distance.wrap(alcids, SMP_EFFORT="WatchLenKm",SIZE="Count", breaks=c(0,300),Type="Line",
                         units=list(Distance="Perp",Length_units="Kilometers",
                                    Distance_units="Meters",Area_units="Square kilometers"),
                         STR_LABEL="STR_LABEL", STR_AREA="STR_AREA",SMP_LABEL="WatchID", 
                         path="c:/temp/distance",
                         pathMCDS="C:/Program Files (x86)/Distance 6")

summary(strip.out1)
#END

RoyChristian/R2MCDS documentation built on Jan. 13, 2020, 8:17 p.m.