Download presentation
Presentation is loading. Please wait.
Published byNeil Griffith Modified over 8 years ago
1
Lecture 17: Multi-stage models with MARSS, etc
2
Multivariate time series with MARSS We’ve largely worked with: 1. Different time series of the same species 2. Different species from the same community 3. We can also have time series of different age classes from same species
3
Equations Order of events is important Age or stage structured data? For juvenile / adult dynamics, does survival or reproduction happen first
4
Mortality first, then reproduction Or modify to include ‘plus group’
5
Mortality first, then reproduction Survey happens before birth pulse Or modify to include ‘plus group’
6
Reproduction, then mortality Survey after birth pulse Or modify to include ‘plus group’
7
Before pulse After pulse
8
Linear equations -> Leslie matrix models We’ll assume survey after births Transition matrix:
9
Linear equations -> Leslie matrix models We’ll assume survey after births (and + group) Transition matrix used to project population: This should look very familiar! Similar to
10
Including multiplicative process error Leslie matrix models generally of the form
11
We can try to approximate this with MARSS, but several issues arise 1. Errors multiplicative In MARSS they are additive
12
We can’t just log observed data Taking natural log of both sides doesn’t work
13
The only option left… Additive error (pop can go negative) In MARSS notation
14
Constraining B matrix Enter B as list matrix For model without plus group, B=matrix(list(0,"s1","f2",0),2,2)
15
Example: wolf count data wolf.adults = c(21,12,13,18,25,28,48,46,60,52,46,36,57,48) wolf.pups = c(0,8,19,24,10,37,22,32,38,32,8,39,37,8)
16
Fitting the model with MARSS dat = rbind(wolf.adults,wolf.pups) leslie = MARSS(dat, model = list(x0=matrix(c(21, 0), nrow=2), Q = "diagonal and unequal", U = "zero", Z = "identity", R = "zero", B=matrix(list(0,"s1","f2",0),2,2)), control=list(allow.degen=FALSE)) Bout =matrix(c(0,leslie$par$B[1,1],leslie$par$B[2,1],0),2,2)
17
Because the model is not exactly what we want, let’s use JAGS model = cat(" model { # fit the multiplicative leslie matrix model to the wolf data s1 ~ dunif(0,1); # constrain to be 0-1 f1 ~ dnorm(0,1)T(0,); # constrain to be positive q[1] ~ dgamma(0.001,0.001); q[2] ~ dgamma(0.001,0.001); for(t in 2:N) { # this model is written out in the long form predAdults[t] <- wolf.pups[t-1] * s1; predPups[t] <- wolf.adults[t-1] * f1; wolf.adults[t] ~ dnorm(predAdults[t],q[1]); wolf.pups[t] ~ dnorm(predPups[t],q[2]); } ", file = "model.txt") jags.data = list("wolf.adults"=wolf.adults,"wolf.pups"=wolf.pups,"N" = length(wolf.adults)) jags.params=c("s1","f1") model.loc=("model.txt") jags.model = jags(jags.data, inits = NULL, parameters.to.save= jags.params, model.file=model.loc, n.chains = mcmc.chains, n.burnin = mcmc.burn, n.thin = mcmc.thin, n.iter = mcmc.chainLength, DIC = TRUE) attach.jags(jags.model)
19
Turning these into population growth Calculating eigenvalues g = 0 for(i in 1:length(f1)) { g[i] = max(abs(eigen(matrix(c(0,s1[i],f1[i],0),2,2))$values)) }
20
Adding multiplicative error model = cat(" model { # fit the multiplicative leslie matrix model to the wolf data s1 ~ dunif(0,1); # constrain to be 0-1 f1 ~ dnorm(0,1)T(0,); # constrain to be positive q[1] ~ dgamma(0.001,0.001); q[2] ~ dgamma(0.001,0.001); for(t in 2:N) { # this model is written out in the long form predAdults[t] <- wolf.pups[t-1] * s1; predPups[t] <- wolf.adults[t-1] * f1; wolf.adults[t] ~ dlnorm(log(max(predAdults[t],0.001))-(1/q[1])/2,q[1]); wolf.pups[t] ~ dlnorm(log(max(predPups[t],0.001))-(1/q[2])/2,q[2]); } } ", file = "model1.txt") jags.data = list("wolf.adults"=wolf.adults,"wolf.pups"=wolf.pups,"N" = length(wolf.adults)) jags.params=c("s1","f1") model.loc=("model.txt") jags.model1 = jags(jags.data, inits = NULL, parameters.to.save= jags.params, model.file=model.loc, n.chains = mcmc.chains, n.burnin = mcmc.burn, n.thin = mcmc.thin, n.iter = mcmc.chainLength, DIC = TRUE) attach.jags(jags.model1)
21
Adding complexity: multiplicative process error
22
Adding observation error component model = cat(" model { # fit the multiplicative leslie matrix model to the wolf data s1 ~ dunif(0,1); # constrain to be 0-1 f1 ~ dnorm(0,1)T(0,); # constrain to be positive q[1] ~ dgamma(0.001,0.001); q[2] ~ dgamma(0.001,0.001); true.pups[1] ~ dnorm(0,0.01)T(0,); true.adults[1] ~ dnorm(0,0.01)T(0,); for(t in 2:N) { # this model is written out in the long form predAdults[t] <- true.pups[t-1] * s1; predPups[t] <- true.adults[t-1] * f1; true.adults[t] ~ dlnorm(log(max(predAdults[t],0.001))-(1/q[1])/2,q[1]); true.pups[t] ~ dlnorm(log(max(predAdults[t],0.001))-(1/q[1])/2,q[1]); } tauR ~ dgamma(0.001,0.001); for(t in 2:N) { wolf.adults[t] ~ dlnorm(log(max(true.adults[t],0.001)), tauR); wolf.pups[t] ~ dlnorm(log(max(true.pups[t],0.001)), tauR); } ", file = "model2.txt")
23
Results now different
24
Final modification: adding plus group Represents survival of adults -> adults Adds additional parameter to B matrix Useful for species that have age structured data, but we’re fitting stage-structured model to – Wolves live longer than 2 years – Many fish spp very similar (Fish 507, etc)
25
Adding this to the multiplicative error model model = cat(" model { # fit the multiplicative leslie matrix model to the wolf data s1 ~ dunif(0,1); # constrain to be 0-1 f1 ~ dnorm(0,1)T(0,); # constrain to be positive s2 ~ dunif(0,1); q[1] ~ dgamma(0.001,0.001); q[2] ~ dgamma(0.001,0.001); for(t in 2:N) { # this model is written out in the long form predAdults[t] <- wolf.pups[t-1] * s1 + wolf.adults[t-1] * s2; predPups[t] <- wolf.adults[t-1] * f1; wolf.adults[t] ~ dlnorm(log(max(predAdults[t],0.001))-(1/q[1])/2,q[1]); wolf.pups[t] ~ dlnorm(log(max(predPups[t],0.001))-(1/q[2])/2,q[2]); } } ", file = "model4.txt") jags.data = list("wolf.adults"=wolf.adults,"wolf.pups"=wolf.pups,"N" = length(wolf.adults)) jags.params=c("s1","f1","s2") model.loc=("model4.txt") jags.model4 = jags(jags.data, inits = NULL, parameters.to.save= jags.params, model.file=model.loc, n.chains = mcmc.chains, n.burnin = mcmc.burn, n.thin = mcmc.thin, n.iter = mcmc.chainLength, DIC = TRUE) attach.jags(jags.model4)
27
Very different inference about population growth
28
Is population declining? Looks like growing population whose births have fallen as population size increased
29
Wolf dataset was ideal Estimates of s1 and s2 converged, but there are sometimes convergence issues
30
Solutions Use informative prior on survival rates from other studies Validate model output from other studies to constrain possible range of parameters
31
Examples of priors / other studies Include mark-recapture data alongside time series of stage-structured counts Integrated population models
32
Abadi et al. 2010
34
Overview Western SSLs have declined Affected by many potential risks: – Changing age structure? – Climate? – Fishing? – Predation? Challenge: no data on time series of vital rates, just time series on animal abundance
35
Stage structured time series data limited Adult counts – Breeding sites (rookeries) – Non-breeding sites (haul outs) Pup counts – Fewer aerial surveys compared to adults
36
Leveraging other data Holmes et al. 2007 also measured 10000s of sea lions to calculate % juvenile Not included as part of statistical model, but used as validation with other data – Pregnancy surveys – Mark-recapture estimates
38
Non-linear age-structured models In fisheries, maybe the most common form = stock-recruit curves Ricker, Beverton-Holt, Pella-Tomlinson, etc. We’ve used Ricker with MARSS because it is linear – Mark’s DLM lab + homework
39
Ricker formulation is also a bit odd Spawners appear as both covariate and observed data As an alternative, let’s say we had age structured data on recruits + adults
40
Chinook spawner-recruit data
41
We need two models Spawners -> Recruitment – We’ll choose Beverton Holt because it’s nonlinear Recruitment -> Spawners – We’ll assume constant mortality – 3 year lag (overly simplistic)
42
Implementing the model in JAGS model = cat(" model { # fit the multiplicative leslie matrix model to the wolf data a ~ dnorm(0,1); b ~ dnorm(0,1); M ~ dunif(0,10); q[1] ~ dgamma(0.001,0.001); q[2] ~ dgamma(0.001,0.001); for(t in 1:4) { predS[t]<-0; # first 4 years discarded predR[t]<-0; } for(t in 5:N) { # this model is written out in the long form predR[t] <- Y.S[t-1] * a / (b + Y.S[t-1]); predS[t] <- Y.R[t-1 - 3] * exp(-M); Y.S[t] ~ dlnorm(log(max(predS[t],0.001))-(1/q[1])/2,q[1]); Y.R[t] ~ dlnorm(log(max(predR[t],0.001))-(1/q[2])/2,q[2]); } ", file = "skagitModel.txt") jags.data = list("Y.S"=Y.S,"Y.R"=Y.R,"N" = length(Y.S)) jags.params=c("a","b","M","predS","predR") model.loc=("skagitModel.txt") skagit.model = jags(jags.data, inits = NULL, parameters.to.save= jags.params, model.file=model.loc, n.chains = mcmc.chains, n.burnin = mcmc.burn, n.thin = mcmc.thin, n.iter = mcmc.chainLength, DIC = TRUE) attach.jags(skagit.model) jags.data = list("Y.S"=Y.S,"Y.R"=Y.R,"N" = length(Y.S)) jags.params=c("a","b","M","predS","predR") model.loc=("skagitModel.txt") skagit.model = jags(jags.data, inits = NULL, parameters.to.save= jags.params, model.file=model.loc, n.chains = mcmc.chains, n.burnin = mcmc.burn, n.thin = mcmc.thin, n.iter = mcmc.chainLength, DIC = TRUE) attach.jags(skagit.model)
43
Fits to spawner data
44
Diagnostics Fits suggest B ~ 0 = recruitment constant (=a)
45
Does including observation error improve things?
46
Summary Can’t overcome bad models Improved / more robust estimates with additional data MARSS package isn’t ideal for dealing with these types of problems
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.