model { Tau.noninformative <- 1.0E-2 Tau.gamma <- 1.0E-1 Tau.err <- 10 # Observation for (i in 1:N.quad) { for (j in 1:N.sp) { MassA[i, j] ~ dnorm(massA[i, j], tau[1]) massA[i, j] <- occ[i, j] * bm[i, j] occ[i, j] <- step(Occurrence[i, j] + occurrence[i, j] - 1) Occurrence[i, j] ~ dbern(prob[i, j]) } } # Competition and occurrence for (i in 1:N.quad) { for (j in 1:N.sp) { # occurrence occurrence[i, j] ~ dbern(prob[i, j]) prob[i, j] <- 1 - exp(-exp(betaB[5]) * bm[i, j]) # biomass after competition bm[i, j] <- alpha[i, j] * alpha[i, j] / sum.alpha[i] } } # Potential biomass and competitive ability for (i in 1:N.quad) { sum.alpha[i] <- sum(alpha[i,]) for (j in 1:N.sp) { # alpha[i, j]: competitive ability alpha[i, j] <- exp(log.pbm[i, j]) # potential biomass log.pbm[i, j] ~ dnorm(log.mu[i, j], tau[2]) log.mu[i, j] <- ( (betaB[1] + betaS[1, j]) + (betaB[2] + betaS[2, j]) * Alt[i] + betaB[3] * Tree[j] + betaB[4] * Evergreen[j] ) } } # Parameters and hyper parameters for (k in 1:N.betaB) { betaB[k] ~ dnorm(0, Tau.noninformative) } for (k in 1:N.betaS) { for (j in 1:N.sp) { betaS[k, j] ~ dnorm(0, tau.betaS[k]) } tau.betaS[k] ~ dgamma(Tau.gamma, Tau.gamma) } tau[1] ~ dgamma(Tau.err, Tau.err) tau[2] ~ dgamma(Tau.gamma, Tau.gamma) }