Skip to main content
replaced http://stats.stackexchange.com/ with https://stats.stackexchange.com/
Source Link

This model, when estimated in rstan, diverges from the results obtained from a grid approximation of the posterior. I'm trying to pin down why. (Interested readers might find that this question is a follow-on to my answer herehere.)

This model, when estimated in rstan, diverges from the results obtained from a grid approximation of the posterior. I'm trying to pin down why. (Interested readers might find that this question is a follow-on to my answer here.)

This model, when estimated in rstan, diverges from the results obtained from a grid approximation of the posterior. I'm trying to pin down why. (Interested readers might find that this question is a follow-on to my answer here.)

added 643 characters in body
Source Link
Sycorax
  • 94k
  • 23
  • 236
  • 390

I have a model to achieve Bayesian estimates the population size $N$ and probability of detection $\theta$ in a binomial distribution solely based on the observed number of observed objects $y$: $$ p(N,\theta|y)\propto \frac{ \text{Bin}(y|N,\theta)}{N} $$ for $ \left\{N|N\in\mathbb{Z}\land N\ge \max(y)\right\}\times(0,1) $. For simplicity, we assume that $N$ is fixed at the same, unknown value for each $y_i$. In this example, $y=53,57,66,67,73$.

----

I needed more space to clarify a point from Juho's answer. If I understand correctly, we can integrate $\theta$ out of the posterior to obtain the beta-binomial distribution: $$ p(y|N,\alpha,\beta)={N\choose y} \frac{\text{Beta}(y+\alpha, N-y+\beta)}{\text{Beta}(\alpha,\beta)} $$

In our case, $\alpha=1$ and $\beta=1$ because we have a uniform prior on $\theta$. I believe that the posterior should then be $p(N|y)\propto N^{-1}\prod_{i=1}^K p(y_i|N,\alpha=1,\beta=1)$ where $K=\#(y)$ because $p(N)=N^{-1}$. But this appears to wildly diverge from Juho's answer. Where have I gone wrong?

I have a model to achieve Bayesian estimates the population size $N$ and probability of detection $\theta$ in a binomial distribution solely based on the observed number of observed objects $y$: $$ p(N,\theta|y)\propto \frac{ \text{Bin}(y|N,\theta)}{N} $$ for $ \left\{N|N\in\mathbb{Z}\land N\ge \max(y)\right\}\times(0,1) $. For simplicity, we assume that $N$ is fixed at the same, unknown value for each $y_i$.

I have a model to achieve Bayesian estimates the population size $N$ and probability of detection $\theta$ in a binomial distribution solely based on the observed number of observed objects $y$: $$ p(N,\theta|y)\propto \frac{ \text{Bin}(y|N,\theta)}{N} $$ for $ \left\{N|N\in\mathbb{Z}\land N\ge \max(y)\right\}\times(0,1) $. For simplicity, we assume that $N$ is fixed at the same, unknown value for each $y_i$. In this example, $y=53,57,66,67,73$.

----

I needed more space to clarify a point from Juho's answer. If I understand correctly, we can integrate $\theta$ out of the posterior to obtain the beta-binomial distribution: $$ p(y|N,\alpha,\beta)={N\choose y} \frac{\text{Beta}(y+\alpha, N-y+\beta)}{\text{Beta}(\alpha,\beta)} $$

In our case, $\alpha=1$ and $\beta=1$ because we have a uniform prior on $\theta$. I believe that the posterior should then be $p(N|y)\propto N^{-1}\prod_{i=1}^K p(y_i|N,\alpha=1,\beta=1)$ where $K=\#(y)$ because $p(N)=N^{-1}$. But this appears to wildly diverge from Juho's answer. Where have I gone wrong?

deleted 48 characters in body
Source Link
Sycorax
  • 94k
  • 23
  • 236
  • 390

I have a model to achieve Bayesian estimates the population size $N$ and probability of detection $\theta$ in a binomial distribution solely based on the observed number of observed objects $y$: $$ p(N,\theta|y)\propto \frac{ \text{Bin}(N,\theta)}{N} $$$$ p(N,\theta|y)\propto \frac{ \text{Bin}(y|N,\theta)}{N} $$ for $ \left\{N|N\in\mathbb{Z}\land N\ge \max(y)\right\}\times(0,1) $. For simplicity, we assume that $N$ is fixed at somethe same, unknown value for each $y_i$.

#Grid Approximation The grid approximation was produced as below. Memory constraints prevent me making a finer grid on my laptop.

I computed the grid approximation with this code.

I have a model to achieve Bayesian estimates the population size $N$ and probability of detection $\theta$ in a binomial distribution solely based on the observed number of observed objects $y$: $$ p(N,\theta|y)\propto \frac{ \text{Bin}(N,\theta)}{N} $$ for $ \left\{N|N\in\mathbb{Z}\land N\ge \max(y)\right\}\times(0,1) $. For simplicity, we assume that $N$ is fixed at some unknown value for each $y_i$.

#Grid Approximation The grid approximation was produced as below. Memory constraints prevent me making a finer grid on my laptop.

I computed the grid approximation with this code.

I have a model to achieve Bayesian estimates the population size $N$ and probability of detection $\theta$ in a binomial distribution solely based on the observed number of observed objects $y$: $$ p(N,\theta|y)\propto \frac{ \text{Bin}(y|N,\theta)}{N} $$ for $ \left\{N|N\in\mathbb{Z}\land N\ge \max(y)\right\}\times(0,1) $. For simplicity, we assume that $N$ is fixed at the same, unknown value for each $y_i$.

#Grid Approximation The grid approximation was produced as below. Memory constraints prevent me making a finer grid on my laptop.

Source Link
Sycorax
  • 94k
  • 23
  • 236
  • 390
Loading