Estimating parameters in the Bayesian model
We used Markov chain Monte Carlo (MCMC) simulations in the Bayesian
framework to estimate parameters in each model. In the model to estimate
and visualise natural selection, we also used a non-informative prior
distribution with all parameters described in a previous study (Ito &
Konuma, 2020). The shell colour used in our models was standardised by
the z-score before using the MCMC to avoid numerical instability and
to improve the mixing of each chain (Gilks & Roberts, 1996). To obtain
the posterior distribution of each parameter in our models, we then
generated three Markov chains using 2,000 MCMC simulations that were
thinned at a rate of five following the initial burn-in of 1,000
iterations. In the model to visualise natural selection, 2,500 MCMC
simulations were required. The convergence with all simulations was
confirmed by Gelman and Rubin statistics (Gelman et al. , 2011).
Then, a 95% Bayesian confidence interval for all parameters was used
for the posterior distribution summary. For the MCMC simulations, we
used pystan (https://github.com/stan-dev/pystan) in Python 3.