Estimating Demographic Parameters from Samples of Unmarked Individuals
1. Background Model definitions Tools Tests
Estimating demographic parameters from
samples of unmarked individuals
Ben Bolker
Departments of Mathematics & Statistics and Biology, McMaster University
8 March 2011
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
2. Background Model definitions Tools Tests
Outline
1 Background
Ecological/statistical motivations
Study system
2 Model definitions
3 Tools
State-space models
Markov chain Monte Carlo
Gibbs/block sampling
4 Tests
Perfect observation, trivial dynamics
Perfect observation, non-trivial dynamics
Imperfect observation
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
3. Background Model definitions Tools Tests
Ecological/statistical motivations
Cryptic density-dependence
Environmental variation
+ correlated variation in
density . . .
= cryptic
density-dependence
best possible estimates of
demographic parameters?
(Wilson & Osenberg 2002, Shima &
Osenberg 2003)
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
4. Background Model definitions Tools Tests
Ecological/statistical motivations
Data
Repeated samples of individual animals
. . . Multiple times, observers, locations
Presence and size (imperfect)
Estimate demographic parameters:
birth/immigration
death/emigration
change (growth)
. . . as a function of size, (population density)
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
5. Background Model definitions Tools Tests
Ecological/statistical motivations
Data
Repeated samples of individual animals
. . . Multiple times, observers, locations
Presence and size (imperfect)
Estimate demographic parameters:
birth/immigration
death/emigration
change (growth)
. . . as a function of size, (population density)
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
6. Background Model definitions Tools Tests
Study system
Natural history
Thalassoma hardwicke
(sixbar wrasse)
Settlement: ≈ 5–10 mm
Growth: a few mm per month
Death: by predator
(competition for refuges)
Immigration/emigration:
photo: Leonard Low, Flickr via species.wikimedia.org rare below 40–50 mm
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
7. Background Model definitions Tools Tests
Study system
Where they live
Patch reefs, French
Polynesia (and
throughout the south
Pacific)
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
8. Background Model definitions Tools Tests
Study system
What they look like to me
80
Estimated fish size (mm)
60
40
20
Feb Mar Apr May Jun Jul
Date
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
9. Background Model definitions Tools Tests
Study system
40
What they look like to me
20
Feb Mar Apr
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
10. Background Model definitions Tools Tests
Study system
Outline
1 Background
Ecological/statistical motivations
Study system
2 Model definitions
3 Tools
State-space models
Markov chain Monte Carlo
Gibbs/block sampling
4 Tests
Perfect observation, trivial dynamics
Perfect observation, non-trivial dynamics
Imperfect observation
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
11. Background Model definitions Tools Tests
Outline
1 Background
Ecological/statistical motivations
Study system
2 Model definitions
3 Tools
State-space models
Markov chain Monte Carlo
Gibbs/block sampling
4 Tests
Perfect observation, trivial dynamics
Perfect observation, non-trivial dynamics
Imperfect observation
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
12. Background Model definitions Tools Tests
Demographic parameters as f (size)
Growth Appearance Persistence
1.0
0.8
0.6
Probability
(per day)
0.4
a.settle
l.grow b.settle a.mort
0.2 tot.settle c.mort
0.0
1020304050607080 1020304050607080 1020304050607080
Fish size (mm)
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
13. Background Model definitions Tools Tests
Observation model
Detection Measurement
(probability) (standard deviation)
0.8
3.5
0.6 3.0
2.5 Measurement error
Double−count
0.4 Zero−count
2.0
1.5
0.2
1.0
10 20 30 40 50 60 70 80 10 20 30 40 50 60 70 80
Fish size (mm)
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
14. Background Model definitions Tools Tests
Outline
1 Background
Ecological/statistical motivations
Study system
2 Model definitions
3 Tools
State-space models
Markov chain Monte Carlo
Gibbs/block sampling
4 Tests
Perfect observation, trivial dynamics
Perfect observation, non-trivial dynamics
Imperfect observation
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
15. Background Model definitions Tools Tests
State-space models
State-space models
Problem: estimating parameters of systems with un- or
imperfectly-observed states?
Easy if no feedback (measurement error models)
With feedback (dynamic models), brute force approaches
become infeasible . . .
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
16. Background Model definitions Tools Tests
State-space models
Directed acyclic graph (DAG)
parameters
N1 N2 N3 N4 N5
obs1 obs2 obs3 obs4 obs5
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
17. Background Model definitions Tools Tests
Markov chain Monte Carlo
Bayesian statistics, in 30 seconds
computational (convenience) Bayesian statistics
(forget all that stuff about philosophy of statistics, subjectivity, incorporating prior information . . . )
have a likelihood, L(θ) = Prob(data|θ)
want a posterior probability, Ppost (θ) = Prob(θ|data)
Bayes’ rule:
L(θ) · prior(θ)
Ppost (θ) =
L(θ ) · prior(θ ) dθ
may want mean, mode, confidence intervals, . . . denominator
very high-dimensional
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
18. Background Model definitions Tools Tests
Markov chain Monte Carlo
Markov chain Monte Carlo
θA
Posterior probability
MCMC rule:
P(θ A ) J(θ B → θ A )
if =
P(θ B ) J(θ A → θ B )
then stationary distribution =
posterior probability
(provided chain is irreducible etc.)
Parameter value
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
19. Background Model definitions Tools Tests
Markov chain Monte Carlo
Markov chain Monte Carlo
θA
Posterior probability
MCMC rule:
P(θ A ) J(θ B → θ A )
if =
P(θ B ) J(θ A → θ B )
then stationary distribution =
posterior probability
q q
(provided chain is irreducible etc.)
Parameter value
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
20. Background Model definitions Tools Tests
Markov chain Monte Carlo
Markov chain Monte Carlo
θA
Posterior probability
MCMC rule:
P(θ A ) J(θ B → θ A )
if =
P(θ B ) J(θ A → θ B )
then stationary distribution =
posterior probability
q qq
(provided chain is irreducible etc.)
Parameter value
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
21. Background Model definitions Tools Tests
Markov chain Monte Carlo
Markov chain Monte Carlo
θA
Posterior probability
MCMC rule:
P(θ A ) J(θ B → θ A )
if =
P(θ B ) J(θ A → θ B )
then stationary distribution =
posterior probability
(provided chain is irreducible etc.)
q qqq
Parameter value
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
22. Background Model definitions Tools Tests
Markov chain Monte Carlo
Markov chain Monte Carlo
θA
Posterior probability
MCMC rule:
P(θ A ) J(θ B → θ A )
if =
P(θ B ) J(θ A → θ B )
then stationary distribution =
posterior probability
(provided chain is irreducible etc.)
q q q qq
q q qqq
Parameter value
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
23. Background Model definitions Tools Tests
Markov chain Monte Carlo
Markov chain Monte Carlo
θA
Posterior probability
MCMC rule:
P(θ A ) J(θ B → θ A )
if =
P(θ B ) J(θ A → θ B )
then stationary distribution =
posterior probability
(provided chain is irreducible etc.)
Parameter value
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
24. Background Model definitions Tools Tests
Markov chain Monte Carlo
Markov chain Monte Carlo
θA
Posterior probability
MCMC rule:
P(θ A ) J(θ B → θ A )
if =
P(θ B ) J(θ A → θ B )
θB
then stationary distribution =
posterior probability
(provided chain is irreducible etc.)
Parameter value
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
25. Background Model definitions Tools Tests
Markov chain Monte Carlo
Metropolis-(Hastings) updating
θA
Posterior probability
Metropolis rule:
accept B with probability
P(θ B )
min 1,
P(θ A )
satisfies MCMC rule . . . Don’t
need to know denominator!
Candidate distribution
Parameter value
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
26. Background Model definitions Tools Tests
Gibbs/block sampling
Gibbs sampling
Joint distribution of
parameters often difficult
Condition each element
on “known” (i.e. imputed)
values of all other
elements: P(a, b, c) =
P(a|b, c)P(b, c)
0.5
1
Gibbs sampling: do this
5
2.
1.5
2
repeatedly for each
5
1.
2.5
3
element, or block of
5
0.
3.5
4.5
4 3
4 3.5 2
elements
1
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
27. Background Model definitions Tools Tests
Gibbs/block sampling
Gibbs sampling
Joint distribution of
parameters often difficult
q
Condition each element
q q
q
q
on “known” (i.e. imputed)
q
q
q q
q
q
values of all other
q q q
q q
q
qq elements: P(a, b, c) =
q q
q
P(a|b, c)P(b, c)
0.5 q
1
Gibbs sampling: do this
5
2.
q
1.5
2
repeatedly for each
5
1.
2.5
3
element, or block of
5
0.
3.5
4.5
4 3
4 3.5 2
elements
1
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
28. Background Model definitions Tools Tests
Gibbs/block sampling
Gibbs sampling
Joint distribution of
parameters often difficult
q
Condition each element
q q
q
q
on “known” (i.e. imputed)
q
q
q q
q
q
values of all other
q q q
q q
q
qq elements: P(a, b, c) =
q q
q
P(a|b, c)P(b, c)
0.5 q
1
Gibbs sampling: do this
5
2.
q
1.5
2
repeatedly for each
5
1.
2.5
3
element, or block of
5
0.
3.5
4.5
4 3
4 3.5 2
elements
1
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
29. Background Model definitions Tools Tests
Gibbs/block sampling
Back to the DAG
parameters
N1 N2 N3 N4 N5
obs1 obs2 obs3 obs4 obs5
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
30. Background Model definitions Tools Tests
Outline
1 Background
Ecological/statistical motivations
Study system
2 Model definitions
3 Tools
State-space models
Markov chain Monte Carlo
Gibbs/block sampling
4 Tests
Perfect observation, trivial dynamics
Perfect observation, non-trivial dynamics
Imperfect observation
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
31. Background Model definitions Tools Tests
Perfect observation, trivial dynamics
Outline
1 Background
Ecological/statistical motivations
Study system
2 Model definitions
3 Tools
State-space models
Markov chain Monte Carlo
Gibbs/block sampling
4 Tests
Perfect observation, trivial dynamics
Perfect observation, non-trivial dynamics
Imperfect observation
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
32. Background Model definitions Tools Tests
Perfect observation, trivial dynamics
DAG
parameters fates
Demographic parameters|fates:
standard M-H
Fates|parameters
N1 N2
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
33. Background Model definitions Tools Tests
Perfect observation, trivial dynamics
Scenario
One fish of the same size observed
Lsurv = (1 − m)(1 − p) S on two consecutive days . . .
was it the same individual?
(1 − m)(1 − p)
P(surv|m, p) =
1 − m − p + 2mp
X
Lmort = mp(1 − p)S−1
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
34. Background Model definitions Tools Tests
Perfect observation, trivial dynamics
Updating probabilities for parameters
mortality (m)
1.5 If the fish survived, then our
1.0 posterior probabilities for the
0.5 parameters are:
type
probability
immigration (p) prior
m ∼ Beta(1, 2)
density
6
posterior (0 mortalities, 1 survival)
5
4 p ∼ Beta(1, S + 1)
3
2
(0 immigrations, S
1 non-immigrations)
0
0.2 0.4 0.6 0.8
probability
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
35. Background Model definitions Tools Tests
Perfect observation, trivial dynamics
Trivial example: results
mortality (m) immigration (p)
4
2(m + S(1 − m))
3 Beta(p,1,S)
S+1
density
2
1
0
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
value
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
36. Background Model definitions Tools Tests
Perfect observation, trivial dynamics
P(mortality & no immigration) ≈ 0.16 = 1/(S + 1);
P(survival & immigration) ≈ 0.83 = S/(S + 1);
results are simple and make sense; closed form solution is
possible but ugly . . .
combination of observations and non-observation of other
individuals provides information (could fail with non-detection)
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
37. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
Outline
1 Background
Ecological/statistical motivations
Study system
2 Model definitions
3 Tools
State-space models
Markov chain Monte Carlo
Gibbs/block sampling
4 Tests
Perfect observation, trivial dynamics
Perfect observation, non-trivial dynamics
Imperfect observation
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
38. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
Non-trivial dynamics
Multiple individuals, measured over multiple days
Still simple: no density-dependent rates,
immigration/emigration of large individuals
observations still error-free
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
39. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
Parameter/fate sampling
parameters Parameter sampling: M-H
updating with simple
fates(1,2) fates(2,3)
candidate distributions
Fate sampling: ???
Enumerating
N1 N2 N3 possibilities is tedious
...
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
40. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
M-H fate sampling
6 mm 7 mm dead
5 mm G (5) · (1 − M(5)) X M(5)
6 mm (1 − G (6)) · (1 − M(6)) G (6) · (1 − M(6)) M(6)
absent I (6) I (7) X
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
41. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
M-H fate sampling
6 mm 7 mm dead
5 mm G (5) · (1 − M(5)) X M(5)
6 mm (1 − G (6)) · (1 − M(6)) G (6) · (1 − M(6)) M(6)
absent I (6) I (7) X
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
42. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
M-H fate sampling
6 mm 7 mm dead
5 mm G (5) · (1 − M(5)) X M(5)
6 mm (1 − G (6)) · (1 − M(6)) G (6) · (1 − M(6)) M(6)
absent I (6) I (7) X
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
43. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
M-H fate sampling
6 mm 7 mm dead
5 mm G (5) · (1 − M(5)) X M(5)
6 mm (1 − G (6)) · (1 − M(6)) G (6) · (1 − M(6)) M(6)
absent I (6) I (7) X
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
44. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
M-H fate sampling
6 mm 7 mm dead
5 mm G (5) · (1 − M(5)) X M(5)
6 mm (1 − G (6)) · (1 − M(6)) G (6) · (1 − M(6)) M(6)
absent I (6) I (7) X
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
45. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
M-H fate sampling
6 mm 7 mm dead
5 mm G (5) · (1 − M(5)) X M(5)
6 mm (1 − G (6)) · (1 − M(6)) G (6) · (1 − M(6)) M(6)
absent I (6) I (7) X
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
46. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
Sampling test
6 survives
both grow
w
5 grows Sampling
Fate True
Gibbs
6 grows
both die
10−3.5 10−3 10−2.5 10−2 10−1.5 10−1 10−0.5
Probability
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
47. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
Testbed
Simulate for 80 days, with a settlement rate (tot.settle) of
5% day:
29 distinct individuals, size range 5–30, total of 618 fish-days
(observations).
Sample fates only (1000 MCMC steps), fixed demographic
parameters
Sampled 1000 unique fates (but only 895 unique likelihoods)
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
48. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
Testbed
Simulate for 80 days, with a settlement rate (tot.settle) of
5% day:
29 distinct individuals, size range 5–30, total of 618 fish-days
(observations).
Sample fates only (1000 MCMC steps), fixed demographic
parameters
Sampled 1000 unique fates (but only 895 unique likelihoods)
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
49. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
True demography30
25
20
size
15
10
5
0 20 40 60 80
day
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
50. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
Fate-only results
0.05
0.04
Density 0.03
0.02
0.01
0.00 q
−520 −500 −480 −460
Log−likelihood
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
51. Background Model definitions Tools Tests
Perfect observation, non-trivial dynamics
Sampling fates, parameters, both . . .
0.25
0.20
0.15 type
fate only
Density parameters only
0.10 both
0.05
0.00
−500 −490 −480 −470 −460 −450
Log−likelihood
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
55. Background Model definitions Tools Tests
Imperfect observation
Outline
1 Background
Ecological/statistical motivations
Study system
2 Model definitions
3 Tools
State-space models
Markov chain Monte Carlo
Gibbs/block sampling
4 Tests
Perfect observation, trivial dynamics
Perfect observation, non-trivial dynamics
Imperfect observation
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
56. Background Model definitions Tools Tests
Imperfect observation
Adding errors
parameters
fates(1,2) fates(2,3)
Back to the more typical
N1 N2 N3 graph: incorporate information
from N(t − 1), N(t + 1), and
current observation
obs1 obs2 obs3
obs parameters
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
57. Background Model definitions Tools Tests
Imperfect observation
New algorithm
For each individual:
Pick true state at N(t), from all possible states, conditioning
on N(t − 1)
Pick identity at time N(t + 1) from feasible set:
update probabilities
Pick corresponding observation from observed(t):
update probabilities
Calculate likelihood, M-H update
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
58. Background Model definitions Tools Tests
Imperfect observation
Open questions, caveats
Will it work ??
Add complexities:
Multiple populations
Spatial variation, correlation among parameters
Simplify/generalize code
Speed?
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals
59. Background Model definitions Tools Tests
Imperfect observation
Conclusions & musings
MCMC as powerful technology
. . . can it be democratized?
Data limitations shift over time:
hierarchical models are great for “modern” (high-volume,
low-quality) data
Ben Bolker Departments of Mathematics & Statistics and Biology, McMaster University
Estimating unmarked individuals