Exercise description

Exercise 1:
Example of latent variable occupancy inference
The Hobbiton council has recently expanded
the hobbit-lands further west. However, it
turned out the land is infested with dragons.
Of the 10kmx10km areas studied so far, 70%
of them contained dragons.
No dragons
Here be dragons
A standardized procedure for doing transects
was developed so that each transect has
the same detection probability, given
occupancy. The Hobbiton biology
department has found that the detection
probability for dragon-infested areas is
about 50% per transect.
With no dragon, there is of course, no
Exercise 1: Dragon occupancy
Model: Dragon occupancy (L)  Dragon detection (D)
What’s the (marginal) probability that
you’ll detect a dragon on any one
Since field biologists are getting scarce, the council has now reduced the number of
transects to one per area.
Show, using Bayes theorem, that the
probability for having a dragon in the
area given detection is 100%.
Find the probability for there being a
dragon in the area (occupancy) given
that you didn’t detect anything. Could
you expect this probability to drop from it’s
previous value, even without knowing the
specific occupancy rate and detection
Exercise 1: Extra
Since Hobbiton field biologists are now getting
*really* scarce, the transect procedure has
been changed. You are now no longer require
to poke the dragon with a stick before
confirming detection. Visual detection from afar
is now allowed. It is assumed this doesn’t
change the detection rate given occupancy.
As all biologists know, dragons and wyverns can
be confused with each other when seen afar.
It’s assumed this means the false positive rate
(the probability of detection given no dragon
occupancy) is 2%.
What’s the overall detection rate now? Also,
what’s the probability of occupancy given
detection and given no detection now?
Exercise 2: Salamander data using binomial model
Detection data from a salamander species will be examined using a purely binomial
model and using the occupancy model. There are A=39 areas.
R-code for data can be found describing the data plus some likelihood-code:
http://folk.uio.no/trondr/finse/salamanders_ml.R or
Study the data using the binomial model (the issue of occupancy is ignored).
a) Study the histogram of detection counts, ki. Are there signs of zero-inflation?
b) Plot the likelihood function or it’s logarithm in it’s ordered form and try to do
ML estimation
L( p)   p ki (1  p) ni ki
i 1
l ( p)   ki log( p)  (ni  ki ) log(1  p)
c) Do the isame
for the unordered form (with the binomial coefficient). Discuss
the differences and sameness of these plots. Will be inference be different?
d) The ML estimate for p is k/n, where k=ki, n= ni. What’s the log-likelihood?
Exercise 3: Salamander data using occupancy
Study the data using the occupancy model.
a) Fetch the code for the likelihood (ordered version) at
or write it yourself.
b) Plot the likelihood surface (the function now has two inputs,  and p). You
can use “contour” in R. Estimate the parameters graphically.
L( p)  p ki (1  p) ni ki  (1  ) I (ki  0)
i 1
l ( p)   log p ki (1  p) ni ki  (1  ) I (ki  0)
i 1
c) Use numeric optimization to calculate the ML estimates for  and p.
d) Find the likelihood value for these estimates.
e) Use the likelihood ratio-test to test whether we need to reject the
binomial model to the advantage of the occupancy model or not.
D  2(l1 (ˆ1 )  l0 (ˆ0 ))   2 dim(1 )dim( 0 ) in general,or in our case
D  2(locc ( pˆ occ ,ˆ )  lbinom ( pˆ binom ))   21
Exercise 4: Weta occupancy
Weta is the name given to about 70
endemic to New Zealand.
Again, occupancy modelling is called for.
insect species
You can use the WinBUGS-code for the salamander case to use as a template
for these exercise. See http://folk.uio.no/trondr/finse/salamanders_binom.wb
and http://folk.uio.no/trondr/finse/salamanders_occ.wb. The data can be found
in a WinBUGS digestable format in http://folk.uio.no/trondr/finse/weta.wb.
PS: The Weta data consists of detection counts rather than single detection
indicators. You will thus have to change the likelihood-representation in the
code (from Bernoulli on single detections to binomial for detection counts).
a) Pre-exercise: Redo the analysis on the salamanders.
b) Examine the data using the binomial model. Does the Markov chain seem to
converge? Is it efficient? Look at the posterior distribution of the detection
rate. Compare to the ML approach.
c) Examine the data using the occupancy model. Again, comment on
convergence and efficiency. Study the chains and the posterior distribution
and compare to the ML approach.
d) Extra: Redo the salamander data analysis and compare to the ML estimates
in exercise 3.
Exercise 5: Weta occupancy with an explanation
An expanded version with an explanation variable (goat browsing) is found
here: http://folk.uio.no/trondr/finse/weta_browsed.wb.
Fetch the data with the “browsed” explanation variable.
a) Change the model specification in WinBUGS so that there different
occupancy rates and detection rates for the browsed and the
unbrowsed areas.
b) Study the convergence and efficiency.
c) Compare the posterior of  and p for browsed and unbrowsed areas.
Could the model be simplified while still having some dependency on
the explanation variable?
Exercise 6: Weta occupancy model testing
A template file for model comparison can be found here:
a) Do Bayesian model comparison on binomial vs occupancy (easy),
occupancy with or without explanation variable (hard) or all models
(very hard).
b) Which model would you recommend?
c) Extra: Do frequentist model comparison and compare.

similar documents