-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
173 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -384,7 +384,7 @@ <h4 class="author">Peter Solymos <a href="mailto:[email protected]" class="ema | |
## of deldir() was changed to (simply) "plot". | ||
## | ||
## See the help for deldir() and plot.deldir().</code></pre> | ||
<pre><code>## bSims 0.2-2 2019-12-17 ka-ka-ka-kowp-kowp-kowp</code></pre> | ||
<pre><code>## bSims 0.2-3 2021-03-15 chew-chew-chew</code></pre> | ||
<pre class="r"><code>library(detect) # multinomial models</code></pre> | ||
<pre><code>## Loading required package: Formula</code></pre> | ||
<pre><code>## Loading required package: stats4</code></pre> | ||
|
@@ -785,57 +785,69 @@ <h2>Estimating abundance</h2> | |
<p>This result tells us mean abundance after correcting for availability bias, but we don’t know what area was effectively sampled, and detection of individuals given availability is probably less than 1 because this happens to be a real data set and it is guaranteed that humans in the forest cannot detect birds that are very far (say > 500 m away).</p> | ||
<p>We’ll address these problems next week. Let’s just circle back to the assumptions.</p> | ||
</div> | ||
<div id="further-issues" class="section level2"> | ||
<h2>Further issues</h2> | ||
<p>Stratify the landscape, habitat related behavior (mixture)</p> | ||
<div id="exercise-1" class="section level2"> | ||
<h2>Exercise 1</h2> | ||
<p>What other mechanisms can lead to heterogeneity in behavior?</p> | ||
<p>Use the <code>run_app("bsimsHER")</code> Shiny app to explore:</p> | ||
<ul> | ||
<li>find “edge cases”</li> | ||
<li>copy <code>bsims_all()</code> calls from Shiny</li> | ||
</ul> | ||
</div> | ||
<div id="time-to-1st-detection-info" class="section level2"> | ||
<h2>Time to 1st detection info</h2> | ||
<p>ARU, lots of hits, not always clear how many inds in recording Use tt1 (use the ABMI SM data set)</p> | ||
</div> | ||
<div id="methodological-diffs" class="section level2"> | ||
<h2>Methodological diffs</h2> | ||
<p>ARU vs human on p</p> | ||
</div> | ||
<div id="std-data-ove-time" class="section level2"> | ||
<h2>Std data ove time</h2> | ||
<p>TSSR/ JDAY effects, but migration?</p> | ||
</div> | ||
<div id="bsimsshiny" class="section level2"> | ||
<h2>bSims/Shiny</h2> | ||
<p>We can collect all our settings into a <code>bsims_all</code> call</p> | ||
<pre class="r"><code>xall <- bsims_all( | ||
extent=10, | ||
road=0.25, edge=0.5, | ||
density=c(1, 1, 0), | ||
vocal_rate=phi, | ||
move_rate=1, movement=0.2, | ||
tau=0.8, | ||
tint=c(3,5,10), | ||
rint=c(0.5, 1, 1.5)) | ||
xall</code></pre> | ||
<pre><code>## bSims wrapper object with settings: | ||
## extent : 10 | ||
## road : 0.25 | ||
## edge : 0.5 | ||
## density : 1, 1, 0 | ||
## vocal_rate: 0.5 | ||
## move_rate : 1 | ||
## movement : 0.2 | ||
## tau : 0.8 | ||
## tint : 3, 5, 10 | ||
## rint : 0.5, 1, 1.5</code></pre> | ||
<p>This call does not evaluate the expression, but it creates a ‘closure’ with all the info inside to create independent realizations (i.e. none of the layers will match across the runs)</p> | ||
<pre class="r"><code>xall$new()</code></pre> | ||
<pre><code>## bSims transcript | ||
## 1 km x 1 km | ||
## stratification: HER | ||
## total abundance: 106 | ||
## duration: 10 min | ||
## detected: 4 heard | ||
## 1st event detected by breaks: | ||
## [0, 3, 5, 10 min] | ||
## [0, 50, 100, 150 m]</code></pre> | ||
<div id="exercise-2" class="section level2"> | ||
<h2>Exercise 2</h2> | ||
<p>How does over/under counting influence estimated vocalization rates?</p> | ||
<p>(Hint: use the <code>perception</code> argument.)</p> | ||
<pre class="r"><code>library(bSims) | ||
|
||
phi <- 0.5 | ||
B <- 10 | ||
perc <- seq(0.5, 1.5, 0.1) | ||
|
||
l <- expand_list( | ||
abund_fun = list(identity), | ||
duration = 10, | ||
vocal_rate = phi, | ||
tau = Inf, | ||
tint = list(c(3, 5, 10)), | ||
perception = perc) | ||
str(l[1:2]) | ||
|
||
## a list of bsims_all objects | ||
## $settings() $new(), $replicate(B, cl) | ||
b <- lapply(l, bsims_all) | ||
|
||
## repeat the runs B times for each setting | ||
s <- lapply(b, function(z) { | ||
z$replicate(B, cl=4) | ||
}) | ||
|
||
## removal model | ||
phi_hat <- t(sapply(s, function(r) sapply(r, estimate)["phi",])) | ||
|
||
matplot(perc, phi_hat, lty=1, type="l", col="grey", ylim=c(0, max(phi_hat))) | ||
lines(perc, apply(phi_hat, 1, median), lwd=2) | ||
abline(h=phi) | ||
|
||
matplot(perc, 1-exp(-1*phi_hat), lty=1, type="l", col="grey", ylim=c(0,1)) | ||
lines(perc, 1-exp(-1*apply(phi_hat, 1, median)), lwd=2) | ||
abline(h=1-exp(-1*phi), lty=2)</code></pre> | ||
<p>This is how perceived individual ID is deduced using locations:</p> | ||
<pre class="r"><code>set.seed(1) | ||
x <- bsims_all(density=0.1)$new() | ||
perception <- 0.75 | ||
|
||
z <- get_events(x) | ||
z <- z[!duplicated(z$i),] | ||
dim(z) | ||
hc <- hclust(dist(cbind(z$x, z$y)), method="ward.D2") | ||
|
||
h <- length(unique(z$i)) * perception | ||
z$j <- cutree(hc, k=min(nrow(z), max(1, round(h)))) | ||
|
||
plot(hc) | ||
table(true=z$i, perceived=z$j) | ||
plot(z$x, z$y, pch=z$j, col=z$j)</code></pre> | ||
</div> | ||
|
||
|
||
|