OpenBUGS code for fitting a Von Bertalanffy model to growth increment data for male Growling
Grass Frogs, as per Heard et al. 2012 (Austral Ecology 37, 276-284)
model{
#priors
a ~ dunif(50,120)
k ~ dunif(0,100)
tau ~ dgamma(0.001, 0.001)
sigma <- 1 / sqrt(tau)
#specify the model
for(i in 1:65){
SGLr [i] ~ dnorm(mu.r[i], tau)
mu.r[i] <- a - (a - SGLi[i]) * exp(-k * Days[i])
}
#derived parameters
#calculate parameter ‘b’ (fraction of asymptotic size yet to be attained at birth)
b <- 1 - (34.31 / a)
#where 34.31 is the mean metamorphling size
#predict growth curve up to 600 days post metamorphosis
for(i in 1:601){
pred[i] <- a * (1 - (b * exp(-k * (i-1))))
}
#predict time to sexual maturity (time to reach 53 mm SGL)
maturity <- -log((a - 53) / (a * b)) / k
#close model
}
#Inits
list(a = 60, k = 0.1, tau = 1)
list(a = 100, k = 0.01, tau = 2)
list(a = 110, k = 0.2, tau = 4)
#Data (‘Days’ = the number of days in the capture interval, SLGi = initial snout-groin length,
#SLGr = snout-groin length at recapture). Only one capture interval per frog is used.
list(
Days =
c(12,101,20,40,66,30,39,30,64,23,23,14,14,14,61,75,46,18,369,41,12,393,63,15,15,80,35,69,269,45,
34,11,261,25,41,51,51,85,23,413,266,89,20,31,63,51,3,22,61,24,17,42,46,42,71,94,91,54,72,48,61,2
1,45,24,24),
SGLi =
c(74,75,67,70,65,71,59,76,63,70,67,67,62,71,70,34,55,57,56,60,65,72,71,61,67,67,63,35,65,71,67,5
5,55,78,80,53,49,53,65,31,40,64,62,56,63,63,69,67,66,66,59,53,70,58,60,38,35,39,54,48,61,60,61,6
7,71),
SGLr =
c(74,82,74,72,67,71,62,80,67,70,67,67,62,75,72,59,60,64,72,64,67,78,73,65,70,73,63,56,67,71,70,5
8,64,78,83,65,66,72,67,71,67,72,65,64,73,69,71,68,72,66,63,55,74,60,68,72,66,56,72,64,70,63,72,7
4,75))