-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add conditional_bernoulli distribution #27
Comments
there are extensions to this model, for example introducing a parameter q_i = p(y_i = 1 | z_i = 0), corresponding to erroneous detections in the imperfect detection case. These could be added via additional, optional parameters |
could this be setup to take more flexible inputs, e.g., for a model with constant p or constant psi across multiple individuals? So \psi could have dims (1 x 1) or (n x 1), and p could have dims (1 x 1), (n x 1), (1 x k), or (n x k), assuming y has dims (n x k). My current way of handling this is:
and
|
Dear @goldingn and @jdyen , thank you pioneering these models in However, I ran into an error while trying to implement Yamaura et al. (2012)'s model in
I think it is related to this thread, because I cannot use Below is two code chunks, one to simulate abundance data and another to fit model (apologies if they look ugly!) : Simulate data
Fit model
|
I don't think this has been added to greta. A post on the greta forum might get some good answers (maybe do a quick search first, someone might have already posted a workaround). |
Thanks for the heads up. Sure I'll move over to the forum and apologies if here isn't the best place to ask :) |
Add a distribution node type for this compound distribution, where the observed variable y can only take value 1 if a latent bernoulli variable z takes value 1, else it must take 0, i.e.:
y_i ~ bernoulli(z * p_i)
z ~ bernoulli(\psi)
p_i = p(y_i = 1 | z = 1)
\psi = p(z = 1)
Inference on p and psi is tractable when there are multiple bernoulli trials in each observation (where p take different values in each trial). The density of this compound distribution (i.e. the likelihood for y) can be calculated directly, explicitly integrating over the latent variable z.
This formulation underpins the ecological imperfect-detection model of MacKenzie et al. which gives the formulation of the likelihood/density.
For each observation in the imperfect detection model, y and p are vectors giving indicating whether a species was detected at each visit, and the probability of detection (which may vary between visits), and z and psi are scalars indicating whether the species was present (assumed the same at all visits) and the probability of being present.
The syntax would be:
(since the distribution is discrete,
y
can't be a variable), wherey
andp
are vectors (or matrices) andpsi
is a scalar (or vector).The text was updated successfully, but these errors were encountered: