Dear Matt,
if you're using unmarked or ubms, then you need to input a regular array. That is, when you don't have an identical number of occasions at all sites (i.e. your data are imbalanced), you must fill it up with missing values (NAs) to
restore balance. In this, it doesn't matter whether you have the NAs interspersed within the history of a site, or whether you move all non-missing data left in a site history, leaving a tail of NAs on the right. Only, you will have to do the same treatment
also to any observational covariates.
If you're using your own code in JAGS or NIMBLE, you can do the same (i.e., restore balance by filling up with NAs). This will result in neater code, though at the cost of some computational inefficiency, since the missing responses
will be estimated when fitting the model. If the number of such added NAs is not too big, this cost can usually be ignored.
If you don't want this inefficiency, then you can:
-
either vectorize the analysis (see analysis of dynamic occupancy model in Section 4.10.2 in the AHM2 book for an example). Here, you string out the detection history matrix into a simple vector, toss out all missing values, and create
additional vectors that index sites, years, occasions etc for each response. In the BUGS code, you then use nested indexing to tell the software from which site, year, occasion etc. a response is coming.
-
another option is to move all non-missing data in the detection history left, leaving a tail of missings on the right on each line. Then, you create a variable that contains the number of non-missing values for each site. And in
the loop, where you define the likelihood of the data, you instruct BUGS to only evaluate the detection history at a site from column 1 until whatever is the number of non-missing occasions at that site.
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 (2016, 2021) and Schaub & Kéry (2022)
---
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 view this discussion visit
https://groups.google.com/d/msgid/hmecology/f2e12a2b-3462-4fd0-bb15-a4f599c705cdn%40googlegroups.com.