WinBUGS中的初始值

时间:2014-10-20 03:10:25

标签: winbugs

我为随机节点提供了所有值,但是WinBUGS仍然给出了链包含未初始化变量的消息。当我尝试生成它时,BUGS给了我一个错误undefined real result。我在这里缺少什么节点?

model { 
  # Population Model start on the 1 of October 2014  

  # Look up initial numbers in each age class
  F1.2014 <- 4 # no. first-year females October 2014 
  F2.2014 <- 2 # no. older females October 2014
  F.2014 <- F1.2014+F2.2014 # total no. of females in October 2014
  F.trans <- 15 # no. of trans. juv females in March 2015
  F2[1] ~ dbin(phi.af.annual, F.2014) # sample number older females alive October 2015 (12 mo)                 
  mutot.2014 <- mu.1*F1.2014+mu.2*F2.2014 # expected number of fledglings 2014/15
  J.2014 ~ dpois(mutot.2014) # sample actual number of fledglings
  JF.2014 ~ dbin(0.5,J.2014) # sample no. juv females in January 2015
  phi.trans<-pow((phi.jf.mo),6) # probability trans juvs survive from March to October  
  F1.trans ~ dbin(phi.trans, F.trans) # sample no. translocated female juven in October 2015 
  F1.juvs ~ dbin(phi.jf,JF.2014) # sample no. female juven in October 2015                         
  F1[1]<-F1.juvs+F1.trans # total number of first year birds in October 2015
  F[1] <- F1[1]+F2[1]
  PE[1] <- step(-F[1]) # prob extinction by October 2015

  # run simulations for 20 years
  for (i in 1:20) {                       
    mutot[i] <- mu.1*F1[i]*mu.2*F2[i] # expected number of total fledglings by females
    J[i] ~ dpois(mutot[i]) # sample total fledglings 
    JF[i] ~ dbin(0.5,J[i]) # sample number female fledglings
    F1[i+1] ~ dbin(phi.jf,JF[i]) # sample number female recruits next year
    F2[i+1] ~ dbin(phi.af.annual,F[i]) # sample number adult females that survive to next year
    F[i+1] <- F1[i+1]+F2[i+1] # total number of females next year
    PE[i+1] <- step(-F[i+1]) # prob that population extinct next year
  }
}

# Data
list(phi.af.annual=0.6, mu.1=2.5, mu.2=3.1, phi.jf.mo=0.8, phi.jf=0.87)

# Inits
list(F1=c(NA, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5), 
     F2=c(NA, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), 
     F1.trans=10, F1.juvs=6, J.2014=20, JF.2014=10,
     J=c(10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 
         10, 10, 10, 10, 10, 10, 10, 10, 10, 10), 
     JF=c(5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5)
)

0 个答案:

没有答案