Simple model question

This is just the points that were sampled. You can even see the burn-in, where the sampler made it’s way up onto the plateau, then wandered around in a circle. See how it “spawned” on the hill part, at large N, so it had a gradient to climb over there.

To see the entire log-likelihood surface, I just made a grid of N and p, then evaluated the log-likelihood at each point using scipy. Something like:

N_grid = np.arange(1, 50)
p_grid = np.linspace(0.01, 0.99, 100)
results = np.zeros((50, 100))
for i, n in enumerate(N_grid):
    for j, p in enumerate(p_grid):
        d = scipy.stats.binom(p=p, n=n)
        logprobs = d.logpmf(obs)
        results[i, j] = lobprobs[np.where(logprobs != -np.inf)].sum()