Dear all,
I am trying to run a fairly simple multi-species occupancy model based on detection/non-detection data where species are modelled as random effects. My primary aim is to estimate species richness at each of the sampling sites. I have a total of 529 sites and a pool of 556 species. The number of repeated surveys varies for each site, ranging from 2 – 651. Detection probability is modelled as a function of two survey specific covariates (Julian day and survey duration) and one site specific covariate (road density). Occupancy probability is modelled simply as the mean. The structure of the model below is based on those in chapter 11 of the AHM book.
model {
## Ecological model
for(k in 1:nspec){ # Loop over species
logit(psi[k]) <- lpsi[k]
for (i in 1:npen) { # Loop over sites
z[i,k] ~ dbern(psi[k])
}
}
## Observation model
for(k in 1:nspec){ # Species
for (i in 1:npen) { # Sites
for (j in 1:survey[i]){ # Index specific survey replicates for each site
logit(p[i,j,k]) <- lp[k] + beta1[k]*Ju[i,j] + beta2[k]*Hr[i,j] + beta3[k]*Rd[i]
mup[i,j,k] <- z[i,k] * p[i,j,k]
Y[i,j,k] ~ dbern(mup[i,j,k])
#Note: Y is a huge 3D array with dimensions: 529 sites x 651 replicates x 556 species
}
}
}
## Derived quantities
for(k in 1:nspec){ # Loop over species
Nocc.fs[k] <- sum(z[,k]) # Num of occupied sites
}
for (i in 1:npen) { # Loop over sites
Nsite[i] <- sum(z[i,]) # Species richness at each site
}
## Priors ##
for(k in 1:nspec){ # Loop over species
lpsi[k] ~ dnorm(mu.lpsi, tau.lpsi)
lp[k] ~ dnorm(mu.lp, tau.lp)
beta1[k] ~ dnorm(mu.beta1, tau.beta1)
beta2[k] ~ dnorm(mu.beta2, tau.beta2)
beta3[k] ~ dnorm(mu.beta3, tau.beta3)
}
mu.psi ~ dunif(0,1)
mu.lpsi <- logit(mu.psi)
sd.lpsi ~ dunif(0,5)
tau.lpsi <- pow(sd.lpsi, -2)
mu.p ~ dunif(0,1)
mu.lp <- logit(mu.p)
sd.lp ~ dunif(0,5)
tau.lp <- pow(sd.lp, -2)
mu.beta1 ~ dnorm(0, 0.1) # Ju - Julian Day
tau.beta1 <- pow(sd.beta1, -2)
sd.beta1 ~ dunif(0,5)
mu.beta2 ~ dnorm(0, 0.1) # Hr - Survey duration
tau.beta2 <- pow(sd.beta2, -2)
sd.beta2 ~ dunif(0,5)
mu.beta3 ~ dnorm(0, 0.1) # Rd - Road density
tau.beta3 <- pow(sd.beta3, -2)
sd.beta3 ~ dunif(0,5)
}
The model does not run to completion and after reading this post I think the problem I’m having is referred to as a “memory leak”. Essentially as I start to run the model the RAM usage surges to maximum capacity until my operating system is destroyed (PC specs: 2.13GHz Intel Xeon CPU with 32GB of RAM).
My data set is obviously very large and no doubt part of the problem. I have run the model using a subset of 100 sites and it does work, although it runs painfully slowly. I’m using JAGS 4.2.0 and running it through jagsUI 1.4.4.
Is there a different way this model could be written so that the process is more efficient? Or have I made a rudimentary error somewhere along the line? I have limited experience with Bayesian models in general so any help or insight would be greatly appreciated!
Hello Dominic,
Exactly these months I have been wrestling with a similar problem with a community model in JAGS, with a dynamic model with only two primary periods (= Atlas periods) and 124 species, but with a total of 3500 sites. The model doesn’t run at all on my powerful desktop and even on a supercomputer we have so far not been able to run it. So one of the things that I tried (today !) was to drop the random-effects assumptions about the species-specific effects, i.e., turning the model back to a fixed-effects model and now it seems to run on my desktop, at least for short trial runs. I think this is not ideal, as treating species-level params as random would be the natural way, but treating them as fixed is not wrong and will allow me to obtain species richness estimates that are valid, though perhaps I would get more precision with the usual random-effects version of the model.
Best regards -- Marc
--
*** Three hierarchical modeling email lists ***
(1) unmarked: for questions specific to the R package unmarked
(2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
(3) HMecology (this list): for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2015)
---
You received this message because you are subscribed to the Google Groups "hmecology: Hierarchical Modeling in Ecology" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
hmecology+...@googlegroups.com.
To post to this group, send email to
hmec...@googlegroups.com.
Visit this group at https://groups.google.com/group/hmecology.
To view this discussion on the web visit
https://groups.google.com/d/msgid/hmecology/e20c3b00-6caf-43f9-93f9-9a1cb93c3821%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to hmecology+unsubscribe@googlegroups.com.
To post to this group, send email to hmec...@googlegroups.com.
Visit this group at https://groups.google.com/group/hmecology.
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/e20c3b00-6caf-43f9-93f9-9a1cb93c3821%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to hmecology+...@googlegroups.com.
To post to this group, send email to hmec...@googlegroups.com.
Visit this group at https://groups.google.com/group/hmecology.
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/e20c3b00-6caf-43f9-93f9-9a1cb93c3821%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to hmecology+unsubscribe@googlegroups.com.
To post to this group, send email to hmec...@googlegroups.com.
Visit this group at https://groups.google.com/group/hmecology.
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/092b0c1a-39df-43c4-b437-8015c40e6029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dear Ken,
It’s true that with jags.basic, one cannot run a job in parallel ?
Thanks and best regards -- Marc
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/092b0c1a-39df-43c4-b437-8015c40e6029%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to hmecology+unsubscribe@googlegroups.com.
To post to this group, send email to hmec...@googlegroups.com.
Visit this group at https://groups.google.com/group/hmecology.
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/092b0c1a-39df-43c4-b437-8015c40e6029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
*** Three hierarchical modeling email lists ***
(1) unmarked: for questions specific to the R package unmarked
(2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
(3) HMecology (this list): for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2015)
---
You received this message because you are subscribed to the Google Groups "hmecology: Hierarchical Modeling in Ecology" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hmecology+unsubscribe@googlegroups.com.
To post to this group, send email to hmec...@googlegroups.com.
Visit this group at https://groups.google.com/group/hmecology.
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/F801018864E940468323F405DF95D2DD75F44A46%40MailNT.vogelwarte.ch.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/092b0c1a-39df-43c4-b437-8015c40e6029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
*** Three hierarchical modeling email lists ***
(1) unmarked: for questions specific to the R package unmarked
(2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
(3) HMecology (this list): for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2015)
---
You received this message because you are subscribed to the Google Groups "hmecology: Hierarchical Modeling in Ecology" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hmecology+...@googlegroups.com.
To post to this group, send email to hmec...@googlegroups.com.
Visit this group at https://groups.google.com/group/hmecology.
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/F801018864E940468323F405DF95D2DD75F44A46%40MailNT.vogelwarte.ch.
For more options, visit https://groups.google.com/d/optout.
Dear Ken,
And “update” will also work when the model has first been fit using “jags.basic”, right ?
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/7f9b055c-cd75-4eb3-9f92-e9cafaa2e1d2%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to hmecology+unsubscribe@googlegroups.com.
To post to this group, send email to hmec...@googlegroups.com.
Visit this group at https://groups.google.com/group/hmecology.
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/24ea3fbe-8976-4c8b-a07e-6a24147c3d75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
*** Three hierarchical modeling email lists ***
(1) unmarked: for questions specific to the R package unmarked
(2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
(3) HMecology (this list): for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2015)
---
You received this message because you are subscribed to the Google Groups "hmecology: Hierarchical Modeling in Ecology" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hmecology+unsubscribe@googlegroups.com.
To post to this group, send email to hmec...@googlegroups.com.
Visit this group at https://groups.google.com/group/hmecology.
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/F801018864E940468323F405DF95D2DD75F44BFE%40MailNT.vogelwarte.ch.
--
Morgan W. Tingley
Assistant Professor
Dept of Ecology and Evolutionary Biology
University of Connecticut
Storrs, CT 06269
--
*** Three hierarchical modeling email lists ***
(1) unmarked: for questions specific to the R package unmarked
(2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
(3) HMecology (this list): for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2015)
---
You received this message because you are subscribed to a topic in the Google Groups "hmecology: Hierarchical Modeling in Ecology" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hmecology/RS17FGi0U60/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hmecology+unsubscribe@googlegroups.com.
To post to this group, send email to hmec...@googlegroups.com.
Visit this group at https://groups.google.com/group/hmecology.
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/4734fc66-8d54-4295-bdbf-e771f416a2d3%40googlegroups.com.
--
*** Three hierarchical modeling email lists ***
(1) unmarked: for questions specific to the R package unmarked
(2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
(3) HMecology (this list): for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2015)
---
You received this message because you are subscribed to the Google Groups "hmecology: Hierarchical Modeling in Ecology" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hmecology+...@googlegroups.com.
To post to this group, send email to hmec...@googlegroups.com.
Visit this group at https://groups.google.com/group/hmecology.
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/CAPreXNjAhw-Hj%2BFM6PSdusLC87uu1a685C%2BVyi3Tu7_yzxorhA%40mail.gmail.com.
I agree with you Marc!
To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/F801018864E940468323F405DF95D2DD75F45D2C%40MailNT.vogelwarte.ch.
For more options, visit https://groups.google.com/d/optout.
-- .............................................. ดุสิต งอประเสริฐ Dusit Ngoprasert Conservation Ecology Program King Mongkut's University of Technology Thonburi E-mail: dusi...@kmutt.ac.th Tel. +66 2 470 7571 Fax. +66 2 452 3455 http://cons-ecol-kmutt.weebly.com/