Multispecies analysis

If the user has collected the same data for many species and is interested in running the same model for many species, it is possible to do so via the lsub and split arguments. The lsub argument consists of a list that contains all the species that the user want to include in the analysis and the split option indicate whether the species should be analyzed together (split=FALSE) or separately (split=TRUE).

For simplicity we will run this example with only one detection function (Half-normal key function with Cosine adjustment). However it is possible to run models with different key functions and subsequently chose the best model for each species.

library(R2MCDS)

### Import and filter data
data(laridae)
d <- mcds.filter(laridae,
                 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.
x <- mcds.wrap(d,
               SMP_EFFORT="WatchLenKm",
               DISTANCE="Distance",
               SIZE="Count",
               Type="Line",
               units=list(Distance="Perp",
                          Length_units="Kilometers",
                          Distance_units="Meters",
                          Area_units="Square kilometers"),
               breaks=c(0,50,100,200,300),
               estimator=list(c("HN","CO")),
               lsub=list(Alpha=c("GBBG","BLKI","HERG")),
               split=TRUE,
               STR_LABEL="STR_LABEL",
               STR_AREA="STR_AREA",
               SMP_LABEL="WatchID",
               path="C:/temp/distance",
               pathMCDS="C:/Program Files (x86)/Distance 7",
               verbose=FALSE)
x

##output for the Black-legged Kittiwake
summary(x[[1]])
plot.distanceFit(x[[1]])
#output for the Great Black-backed Gull 
summary(x[[2]])
plot.distanceFit(x[[2]])
##output for the Herring gull
summary(x[[3]])
plot.distanceFit(x[[3]])

Rare species case

It is also possible to correct the observed densities of a rare species by using the detection curve of a similar species by using multipliers. As usual, the user can choose the key function and adjustment for the reference species or can simply let Distance pick the best model for the reference species (i.e. estimator=NULL).

Distance will first estimate the detection function of the reference species and will then fit a uniform detection function to the rare species but will use a multiplier derived from the detection function of the reference species.

#'### 
library(R2MCDS)

### Import and filter data
data(laridae)
d <- mcds.filter(laridae,
                 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.
x <- mcds.wrap(d,
               SMP_EFFORT="WatchLenKm",
               DISTANCE="Distance",
               SIZE="Count",
               Type="Line",
               units=list(Distance="Perp",
                          Length_units="Kilometers",
                          Distance_units="Meters",
                          Area_units="Square kilometers"),
               breaks=c(0,50,100,200,300),
               estimator=list(c("HN","CO")),
               lsub=list(Alpha=c("HERG")),
               rare= list(Alpha=c("RBGU")),
               split=TRUE,
               STR_LABEL="STR_LABEL",
               STR_AREA="STR_AREA",
               SMP_LABEL="WatchID",
               path="C:/temp/distance",
               pathMCDS="C:/Program Files (x86)/Distance 7",
               verbose=FALSE)
x
##output for the Ring-billed Gull
summary(x)


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