Nature, in Code

# Effective Population Size: Sex Ratio

The effective population size, Ne, is the size of a population that behaves like an ideal (Wright-Fisher) population of size Ne. The sex ratio of a population affects its effective population size. In a population with Nm males and Nf females, the effective population size is:

$$N_e = {4 N_{m} N_{f} \over N}$$
The plot below shows how an unequal sex ratio, expressed as the fraction of males in the population, reduces the effective population size Ne (relative to the census population size N).

#### Code


var data=[];
var x_max = 1;

for (var i = 0; i <= x_max + 0.005; i = i + 0.01) {
var male_to_female_ratio = i;
Ne_to_N_ratio = 4 * male_to_female_ratio * (1 - male_to_female_ratio);
data.push(Ne_to_N_ratio);
}

draw_line_chart(data,"Proportion Males","Ne / N",[],x_max);

Note: the draw_line_chart function is built with D3.js and can be found here.