This might be quite basic but I'm struggling.
I'm trying to take a published ecological model and implement it in the Turing.jl
package using Julia. Say I have a number of species, $S$, and I want to find out the probability of any of them eating another based off of a series of characteristics (traits) of each (i.e. body size, habitat preference etc). The probability of a predator $i$ eating a prey item $j$ is given as:
$$P(i,j,\theta) = \alpha \prod^D_{d=1} \exp\left(- \left|\frac{n_{d,j}-c_{d,i}}{r_{d,i}/2}\right|^e\right).$$
where $\theta = \{ n_{1,1}...n_{D,S},c_{1,1}...c_{D,S},r_{1,1}...r_{D,S},e\}$, the parameter $n_{d,j}$ is the trait value of $j$, the prey, in dimension $d$, $c_{d,i}$ is the optimal feeding position of species $i$ in dimension $d$; $r_{d,i}$ is the feeding range of speices $i$ in dimension $d$, $e$ just varies the shape of the probability function, and $\alpha$ is the probability of $i$ eating $j$ if the trait value of the prey $n_{d,j}$ is equal to the optimal value of the predator $c_{d,i}$.
To reduce the number of free parameters, we can set the range $r_{d,i}$ to a large value (i.e. 10) and $c_{d,i}$ to the centre of the range (i.e. 5) and then simply fit $n_{j,i}$.
The data, $\textbf{X}$ are $S \times S$ matrices containing an observation $X_{ij}$ for each instance $i,j$. ($X_{ij}$ = 1 means $i$ eats $j$, $X_{ij}$ = 0 means $i$ does not eat $j$. The matrices are not especially sparse, (roughly 2/3 1s and 1/3 0s).
Obviously there can only be one outcome (species $j$ is eaten by species $i$ or not eaten AKA 1 or 0), so my goal is to formulate the problem as a Bayesian logistic regression, which takes the form $$ Y \sim Bernoulli(p)$$ but I am unclear how to formulate the probability equation above into some form that I can pass as $p$.
Extra (Possibly Useful?) Info:
In the published version of the model the authors state for the dataset $\textbf{X}$ they estimate the the maximum likelihood parameter set for each link $X_ij$ according to the model, and use simulated annealing.
They state their log-likelihood is:
$$\ell(\textbf{X}|\theta) = \sum_i \sum_j \text{ln}\left\{\begin{array}{lr} P(i,j|\theta), & \text{if } X_{ij}= 1\\ 1-P(i,j|\theta), & \text{if } X_{ij}= 0 \end{array}\right\}$$
I am hoping to frame this in a Bayesian logistic regression as mentioned above.