-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.Rmd
220 lines (173 loc) · 6.74 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
---
output: github_document
---
```{r, include = FALSE}
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))
}
```
```{r}
includeFigure("RdistanceTopBanner.PNG")
```
<!-- badges: start -->
<center>
[](http://www.r-pkg.org/pkg/Rdistance)
[](http://cran.rstudio.com/web/packages/Rdistance/index.html)
[](http://www.r-pkg.org/pkg/Rdistance)
[](https://codecov.io/gh/tmcd82070/Rdistance)
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://github.com/tmcd82070/Rdistance/commits/master)




</center>
<!-- [](https://travis-ci.org/tmcd82070/Rdistance) -->
<!-- badges: end -->
# 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](https://github.com/tmcd82070/Rdistance/wiki/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**:
* [Beginner Line Transects](https://cran.r-project.org/web/packages/Rdistance/vignettes/Rdistance_BeginnerLineTransect.pdf)
* [Extended Beginner Line Transects Examples](https://cran.r-project.org/web/packages/Rdistance/vignettes/Extended_dfuncEstim_Examples.pdf)
```{r}
includeFigure("RdistanceSeparator.PNG")
```
## Features
* Line-transect and point-transects
* Likelihood functions:
+ half-normal (`halfnorm`)
+ hazard rate (`hazrate`)
+ negative exponential (`negexp`)
+ Gamma (`Gamma`)
+ logistic (`logistic`)
* Non-parametric smoothed distance functions (`smu`)
* Built-in key functions: `sine`, `cosine`, and `hermite`
* Expansion terms
* Standard methods: `print`, `plot`, `predict`, `AIC`, etc.
* Observation and transect-level distance function covariates
* Standard R formula model specification (e.g., `distance ~ elevation + observer`)
* Measurement unit control and automatic conversion
* Automated bootstrap confidence intervals
* Overall (study area) abundance estimates
* Custom (user-defined) detection functions
* Help and vignettes reviewed and edited by multiple authors
```{r}
includeFigure("RdistanceSeparator.PNG")
```
## Current Release
The current release is [here](https://github.com/tmcd82070/Rdistance/releases).
## Installation
Install the development version from [GitHub](https://github.com/) with:
``` r
if( !require("devtools") ){
install.packages("devtools")
}
devtools::install_github("tmcd82070/Rdistance")
```
Install the stable version directly from CRAN:
``` r
install.packages("Rdistance")
```
```{r}
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](https://github.com/tmcd82070/Rdistance/wiki) and in
our vignettes.
### Line Transects - No Covariates
```{r sparrowData, echo=TRUE}
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)
```
```{r lineHazrateExample, echo=TRUE}
# 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
```{r lineHazrateExampleCovars, echo=TRUE}
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
```{r thrasherData, echo=TRUE}
# Example data
data("thrasherDetectionData") # access example data
data("thrasherSiteData")
head(thrasherDetectionData) # inspect example data
head(thrasherSiteData)
```
```{r pointHazrateExample, echo=TRUE}
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
```{r pointHazrateExampleCovars, echo=TRUE}
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)
```
<!-- github CI examples for auto rendering of Rmd <https://github.com/r-lib/actions/tree/v1/examples>. -->
```{r}
includeFigure("RdistanceSeparator.PNG")
```
# RECENT CHANGES
See our [NEWS](NEWS.md) file for recent changes.