Published
Edited
Apr 21, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
endSizeByFractionInfertile = {
const N = initialPopSize

const data = []
for (let fractionInfertile = 0; fractionInfertile <= 1; fractionInfertile += 0.01) {
const endSizeWithoutInfertile = N * expectedNumChilds ** numGenerations
const popSizeFactor = (1 - fractionInfertile) ** numGenerations
const exponent = (expectedNumChilds + infertileCompensation * fractionInfertile) ** numGenerations
const endSizeWithInfertile = N * popSizeFactor * exponent
data.push({
fractionInfertile,
size: endSizeWithoutInfertile,
type: "without infertility"
})
data.push({
fractionInfertile,
size: endSizeWithInfertile,
type: "with infertility"
})
}
return data
}
Insert cell
data3 = {
const N = initialPopSize
const data = ["without infertility", "with infertility"].map(label => ({
gen: 0,
size: numGenerations,
type: label
}))

for (let i = 1; i < numGenerations; ++i) {
const endSizeWithoutInfertile = N * expectedNumChilds ** i
const popSizeFactor = (1 - fractionInfertile) ** i
const exponent = (expectedNumChilds + infertileCompensation * fractionInfertile) ** i
const endSizeWithInfertile = N * popSizeFactor * exponent
data.push({
gen: i,
size: endSizeWithoutInfertile,
type: "without infertility"
})
data.push({
gen: i,
size: endSizeWithInfertile,
type: "with infertility"
})
}
return data
}
Insert cell
Insert cell
Insert cell
Insert cell
//viewof fitnessVariance = Range([1, 10], {step: 1, value: 10, label: "Fitness variance"})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more