"Node inconsistent with parents" error in JagsUI when running MSOM with DA

895 views
Skip to first unread message

Jordan Rogan

unread,
Mar 17, 2022, 4:50:10 PM3/17/22
to hmecology: Hierarchical Modeling in Ecology
Hi all,

I am trying to run my first Multi-Species Occupancy model with Data-augmentation on my dissertation data in JagsUI following the general guidelines shown in this JAGS tutorial. I am getting the error message:

"Error in checkForRemoteErrors(val) :
  3 nodes produced errors; first error: Error in node y[27,1]
Node inconsistent with parents


full precision may not have been achieved in 'qbeta'
full precision may not have been achieved in 'qbeta'
full precision may not have been achieved in 'qbeta'"

I did not set initial values, as in the tutorial I referenced above they mentioned it can be better not to. I have been doing some perusing online though and it seems like it could be a good idea to do so, though I'm honestly not really sure how to best do this (new to JAGS/bayes).

 Also, following the tutorial above, my augmented dataset of y detection values includes the total number of detections for species at each site. I've noticed that usually this is just represented as 0s and 1s (as with typical occupancy modeling) for each species for each site. However, it works to run the code this way using total detections for the dataset in the above tutorial, so not sure why it wouldn't work for my dataset.

-I have 25 species and I am augmenting the dataset by 175 (M=200) (I also did this with 32, a more biologically relevant number for my study area, but still got the above error, and had concerns that this value would constrain N..)
-There are 55 sites
-all covariates (other than factor variable) were standardized prior to entry in analysis:
-I have 2 site covariates on occupancy prob (% forest cover, % forest cover^2)
- I have 2 site covariates on detection prob (on/off trail (categorical/factor variable converted to integer vector for Jags), and effort)
-n0cc is the number of occasions/surveys--I use camera traps, and some cameras ran for a bit more time than others, hence there are different values here. They were already collapsed into 7-day repeat detection histories prior to specifying for community modeling 
-I also accounted for correlation between p and psi (rho=estimated correlation parameter)

I attached my code in a text file, as well as the R file, and my csv datasheet with my detection and covariate data for reference. Any insight on this would be hugely helpful, thank you!

Best,

Jordan

MyMSOM_ch1.R
Alldata_msomDA_Ch1.csv
MSOM_CH1.txt

Mike Meredith

unread,
Mar 21, 2022, 1:26:33 AM3/21/22
to hmecology: Hierarchical Modeling in Ecology
Hi Jordan,

The immediate problem is an error in your data:
jagsData$y[27,1]   # 12
jagsData$z[27,1]   # 1, so that's not the issue
jagsData$nOcc[27]  # 11 (!)

So at site #27 the camera trap was active for 11 occasions, and on 12 occasions it detected CA.Agouti. Does not compute. The error probably arose when you pooled the data into 7-day occasions; that throws away information, and I've never seen a convincing argument in favor of it.

The way you handle the categorical variable trail is suboptimal; in the JAGS code you appear to treat it as a continuous covariate. It's binary, so could be represented at 0/1, off/on trail; in that case the JAGS code would be correct -- the intercept corresponds to off-trail traps and the aTrail coefficient to the difference (on the logit scale) between the on-trail and off-trail traps.

I've no idea what your effort covariate could be. For camera traps, that's usually the number of occasions that the camera trap was operational, and that's correctly included in the model with dbin(..., nOcc[i])p is the probability of detecting the species (given it is present) on one occasion at one camera trap and is the same for all occasions; what "effort" would affect that?

Regards, Mike

Jordan Rogan

unread,
Mar 30, 2022, 3:56:48 PM3/30/22
to hmecology: Hierarchical Modeling in Ecology
Thanks all for your input! I recognized the errors there that you pointed out, Mike and the model ran fine once I fixed them. I also had been considering how the effort covariate was redundant with nOcc as you pointed out as well, so I removed it from the model.

Thank you!

Jordan

Reply all
Reply to author
Forward
0 new messages