0

Am familiar with model specification in this provided example with a Poisson distribution on N.lamb, N.ewe, and normal distribution on y.lamb, and y.ewe. I am interested in exploring this under a log-linear transformation. I am providing the sample if someone could correct the specification it will be greatly appreciated. Currently I have not altered the priors to a log scale but have altered in the likelihood portion of the code. Conversion (exponentiation) back to the original form will also be useful.

If someone could also incorporate a random explanatory variable for estimation of N.lamb, and N. ewe in the F and phi portion of the equation for illustrative purposes of transformations, that would also be greatly appreciated. Thanks.

library(jagsUI)

ewe_counts <- structure(list(Year = 1996:2015, Waffles = c(123L, 70L, 66L, 
NA, 51L, NA, 107L, 141L, NA, 118L, NA, 98L, NA, 103L, NA, 164L, 
141L, 90L, 96L, 60L)), class = "data.frame", row.names = c(NA, 
-20L))

lamb_counts <- structure(list(Year = 1996:2015, Waffles = c(70L, 31L, 19L, NA, 
27L, NA, 36L, 35L, NA, 26L, NA, 36L, NA, 34L, NA, 14L, 2L, 2L, 
21L, 20L)), class = "data.frame", row.names = c(NA, -20L))

model { 
  # Priors and constraints
    mu.lamb[1] ~ dunif(0, 300)
    sigma.lamb ~ dgamma(0.25, 0.25)  # SD 
    tau.lamb <- pow(sigma.lamb, -2) # precision
    N.lamb[1] ~ dnorm(mu.lamb[1],tau.lamb)  # Initial lamb abundance
    
    mu.ewe[1] ~ dunif(0, 300)
    sigma.ewe ~ dgamma(0.25, 0.25)  # SD 
    tau.ewe <- pow(sigma.ewe, -2) # precision
    N.ewe[1] ~ dnorm(mu.ewe[1],tau.ewe)   # Initial ewe abundance
    
    N.tot[1] <- N.lamb[1] + N.ewe[1] # Total abundance
    
  
  F ~ dgamma(0.25, 0.25) # Recruitment
  phi ~ dbeta(1, 1)      # Survival
  
  sigma.obs ~ dunif(0, 25)  # SD of observation process
  tau.obs <- pow(sigma.obs, -2)
  
  # Likelihood
    ###################
    ### State process
    ###################
    for (t in 2:(nYears)){
      N.tot[t] <- N.ewe[t] + N.lamb[t]
      
      ## Number of juveniles
      N.lamb[t] ~ dnorm(log(N.ewe[t-1] * F), tau.lamb)
      
      ## Number of adults
      N.ewe[t] ~ dnorm(log(N.tot[t-1] * phi), tau.ewe)
    } # end t loop
    
    ########################
    ### Observation process
    ########################
    for (t in 1:nYears) {
      y.lamb[t] ~ dnorm(log(N.lamb[t]), tau.obs)
      y.ewe[t] ~ dnorm(log(N.ewe[t]), tau.obs)
    }
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.