knitr::opts_chunk$set(
  collapse = TRUE
  , echo = FALSE
  , comment = "#>"
  , fig.path = "README_files/README-"
  , out.width = "100%"
)
includeFigure = function(x) {
  knitr::include_graphics(file.path("README_files", x))
}
includeFigure("RdistanceTopBanner.PNG")

CRAN Version CRAN Downloads CRAN Total Downloads codecov Lifecycle: stable

Simplified Distance-Sampling in R

Rdistance analyzes line- and point-transect distance-sampling data. If you are unfamiliar with distance-sampling, check out our primer, Distance Sampling for the Average Joe. For those ready to take on an analysis, the best place to start is one of our vignettes or in the Examples section (below).

Vignettes:

includeFigure("RdistanceSeparator.PNG")

Features

includeFigure("RdistanceSeparator.PNG")

Current Release

The current release is here.

Installation

Install the development version from GitHub with:

if( !require("devtools") ){
  install.packages("devtools")
}
devtools::install_github("tmcd82070/Rdistance")

Install the stable version directly from CRAN:

install.packages("Rdistance")
includeFigure("RdistanceSeparator.PNG")

Examples

These examples show basic estimation of abundance via distance-sampling analyses, both with and without covariates. Additional information can be found on our wiki and in our vignettes.

Line Transects - No Covariates

if( !require("units") ){
  install.packages("units")
}
library(Rdistance)
library(units)

# Example data
data("sparrowDetectionData")  # access example data
data("sparrowSiteData")
head(sparrowDetectionData)  # inspect data
head(sparrowSiteData)
# Set upper (right) truncation distance
whi <- set_units(150, "m")
# Fit hazard rate likelihood
dfuncFit <- dfuncEstim(dist ~ 1
                   , detectionData = sparrowDetectionData
                   , likelihood = "hazrate"
                   , w.hi = whi)
dfuncFit <- abundEstim(dfuncFit
         , detectionData = sparrowDetectionData
         , siteData = sparrowSiteData
         , area = set_units(2500, "hectares"))
summary(dfuncFit)
plot(dfuncFit)

Line Transects - With Vegetation Covariate

dfuncFit <- dfuncEstim(dist ~ bare
                   , detectionData = sparrowDetectionData
                   , siteData = sparrowSiteData
                   , likelihood = "hazrate"
                   , w.hi = whi)
dfuncFit <- abundEstim(dfuncFit
         , detectionData = sparrowDetectionData
         , siteData = sparrowSiteData
         , area = set_units(2500, "hectares")
         , ci=NULL)
summary(dfuncFit)
plot(dfuncFit, newdata = data.frame(bare = c(30, 40, 50)), lty = 1)

Point Transects - No Covariates

# Example data
data("thrasherDetectionData")  # access example data
data("thrasherSiteData")
head(thrasherDetectionData)  # inspect example data
head(thrasherSiteData)
dfuncFit <- dfuncEstim(dist ~ 1
                   , detectionData = thrasherDetectionData
                   , likelihood = "hazrate"
                   , pointSurvey = TRUE)
dfuncFit <- abundEstim(dfuncFit
         , detectionData = thrasherDetectionData
         , siteData = thrasherSiteData
         , area = set_units(100, "acres"), ci=NULL)
summary(dfuncFit)
plot(dfuncFit)

Point Transects - With Vegetation Covariates

dfuncFit <- dfuncEstim(dist ~ bare + shrub
                   , detectionData = thrasherDetectionData
                   , siteData = thrasherSiteData
                   , likelihood = "hazrate"
                   , pointSurvey = TRUE)
dfuncFit <- abundEstim(dfuncFit
         , detectionData = thrasherDetectionData
         , siteData = thrasherSiteData
         , area = set_units(100, "acres"), ci=NULL)
summary(dfuncFit)
plot(dfuncFit, newdata = data.frame(bare = c(30, 35, 40)
                                  , shrub = 20), lty = 1)
includeFigure("RdistanceSeparator.PNG")

RECENT CHANGES

See our NEWS file for recent changes.



tmcd82070/Rdistance documentation built on April 10, 2024, 10:20 p.m.