Pupa first undergo one extra day of survival, calculated as a binomial over $$\overline{P_{[t-1]}} * (1-\mu_{ad})$$. This is an artifact of the conversion from continuous to discrete time (as mentioned in the original Hancock paper this model is derived from).
Then, pupation is sampled from a binomial, where \((1-\overline{\phi})\) is the genotype-specific probability of becoming male, and \(\overline{\phi}\) is the genotype-specific of becoming female.

oneDay_pupation_stochastic_Patch()