Lesson 6

A

Locked — confirm your name above to begin.

Imagine there are a hundred bunnies alive right now, and we want to figure out how many bunnies there are going to be in the future.

The only two things that can change the number of bunnies are the number of bunnies born and the number of bunnies that die.

What you are going to do is play with the birth rate and the death rate to have some number of bunnies around a hundred years from now. Pay attention to the shape of the curve, and to how much difference between births and deaths you need to get different results.

  • 100 bunnies to begin with, 100 years to run.
  • Each year: what is there, plus the births, minus the deaths.
  • Across: year. Up: how many are alive.
  • The axis rescales itself, so watch the number beside the plot as well as its shape.
  • A pair of numbers only counts once you lock it in. Sliding past a target is not choosing it.
  • The sliders move in thousandths, because near the top of the list a hundredth is too coarse to land on.
births minus deaths:  |  alive at year 100:

Controls

0.200
0.200

Pairs you have locked in

none yet

To open Stage B

  • Finish above 1,000. not yet
  • Finish below 10. not yet
  • Finish between 45 and 55. not yet
  • Finish at exactly 200. not yet
  • Answer the question below.
Stage B is open.
Set births to 0.300 and deaths to 0.280 — two in a hundred between them. Read the plot: how many bunnies are alive at year 100?
bunnies

R code

b <- 0.200d <- 0.200N <- numeric(101); N[1] <- 100for (t in 1:100) N[t+1] <- N[t] + b*N[t] - d*N[t]plot(0:100, N, type = "l")N[101]# the same thing in one line100 * (1 + b - d)^100

B

Solve Stage A to unlock this section.

Returning to the Grants and their study of finches on Daphne Major: because they captured every single one, they know how many birds are alive on their small island each year.

Instead of measuring their beak size, the way we did in Lesson 5, this is the number of birds on the island in each year of their study. What we are going to do is fit the birth rate and the death rate to try to match their data.

In 1977 there was a drought and a lot of birds died. So first we are going to try to get the number of birds down to the size of the crash. Then we are going to try to predict the number of birds alive in 2012.

  • 37 counts, 1976 to 2012. The model starts on the first one and runs.
  • Filled dots are birds counted. The line is the model. The axis stops at 5,000 birds — a model that runs away leaves the top of the plot rather than flattening against it.
  • Typical miss: how far the model sits from the count in an average year, in birds.
  • Same rule as Stage A: a pair only counts once you lock it in.
births minus deaths:  |  typical miss:  |  model in 1977: of 146 counted   in 2012: of 573 counted

Controls

0.20
0.20

Pairs you have locked in

none yet

To open Stage C

  • Match the 1977 population size to within ±25 birds, and lock it in. not yet
  • Match the 2012 population to within ±50 birds, and lock it in. not yet
Two pairs of numbers, and no single pair does both. Stage C is open.

R code

p <- read.csv("data/clean/finch_pop.csv")b <- 0.20d <- 0.20N <- numeric(nrow(p)); N[1] <- p$scandens[1]for (t in 2:nrow(p)) N[t] <- N[t-1] * (1 + b - d)# how far off it is in an average year, in birdsmean(abs(N - p$scandens))

C

Solve Stage B to unlock this section.

Only two things, births and deaths, can change the population. Yet there was no combination of births and deaths that matched the whole trajectory across time in the Grants' finch data.

Obviously the birds are going to have a different birth rate and death rate every single year. You could find the 40 different birth rates and 40 different death rates to perfectly fit the data.

But if you do that: what's the death rate for year 41? The birth rate?

Having 80 parameters (40 death rates + 40 birth rates) gets you zero error… but if you're finding them by just setting them to the data, you've gained no information. You haven't learned how to predict how many birds there will be next year.

What we'd like is to use the data we have — changes in population size over time — to predict the future.

Your goal isn't to get zero error; that's trivial to do by just throwing parameters that teach you nothing at the data. Your goal is to make better predictions about the future.

So instead of trying to predict 40 years of data with 80 parameters that are each made up to fit what we've already seen, we're going to try to predict 40 years of what we've seen using three or four parameters, and see how far we're off. Using fewer parameters means we can test how reliable each one is. We won't fit the data as well, but we'll be on firmer footing when we try to predict the next piece of data in advance.

  • The same 37 counts, the same start, the same run. One rate per year would be 72 numbers here; you get three, and then four.
  • Below the graph is your model: what causes what. Click a dashed arrow to add it, and the slider it pays for switches on.
  • Rain is the island's total for that year, from 1 mm to 1,359 mm.
  • A drawn arrow adds one parameter — one more number you had to go and find. An arrow you have not drawn costs nothing and does nothing.
  • The solid grey arrows are not choices. Next year's count is this year's count plus the births and minus the deaths, so all three run into it whatever you draw.
  • Move the sliders slowly, watching the typical miss. Find where making a number larger makes the fit worse, and where making it smaller does, for each number in turn.
  • Rain first, on its own: the bar is 65 birds. Two numbers alone cannot get below 80.
  • The second arrow only appears once the rain is down. Then the bar is 50 birds. There are usually about 170 birds.
typical miss:  |  parameters in the model: 2

Your birth-death model

Controls

0.30
0.30
0.00

To open Stage D

  • With the rain arrow alone, bring the typical miss under 65 birds. not yet
  • Then, with the arrow that appears, bring it under 50. the rain first
Four numbers, and the shape is most of the way there. Stage D is open.

R code

p <- read.csv("data/clean/finch_pop.csv")r <- read.csv("data/clean/grant_rainfall.csv")wet <- log10(r[match(p$year, r$Year), 2] + 1) - 1.88b0 <- 0.30d0 <- 0.30rainPull  <- 0.00crowdPull <- 0.00N <- numeric(nrow(p)); N[1] <- p$scandens[1]for (t in 2:nrow(p)) {  b <- b0 + rainPull  * wet[t-1]  d <- d0 + crowdPull * (log10(N[t-1]) - 2.24)  N[t] <- N[t-1] * (1 + b - d)}mean(abs(N - p$scandens))

D

Solve Stage C to unlock this section.

Moose have been counted on Isle Royale every winter since 1959. Here are the first forty-two years of it, and nothing else — no weather, no browse, no predators.

One birth rate and one death rate for the whole record, as before. Then a third number: how much extra of the herd dies in a bad year. You decide which years were bad by clicking them.

Every year you mark costs you a click and buys you some fit. Find the fewest that get you there.

  • 42 winter counts, 1959 to 2000. The model starts on the 1959 count.
  • Click the plot at a year to mark it as a bad one. A dashed line drops onto that year; click it again to take it away.
  • Every marked year gets the same extra death rate — you are choosing which years, not how bad each one was. Each year you mark is another parameter.
  • The bar is 130 moose. There are usually about a thousand of them.
typical miss:  |  years marked: 0  |  parameters in the model: 2

Controls

0.200
0.200
0.00

To open Stage E

  • Bring the typical miss under 130 moose. not yet
  • Answer the question below.
Two marked winters and one extra death rate get you there. Stage E is open.
How many bad years does it take? Give the smallest number of marked years that will get you under 130.
years

R code

d0 <- read.csv("data/clean/isle_royale.csv")d0 <- d0[d0$year <= 2000, ]b   <- 0.200d   <- 0.200ex  <- 0.00bad <- c()N <- numeric(nrow(d0)); N[1] <- d0$moose[1]for (t in 2:nrow(d0)) {  dd <- d + ifelse(d0$year[t-1] %in% bad, ex, 0)  N[t] <- N[t-1] * (1 + b - dd)}mean(abs(N - d0$moose))

E

Solve Stage D to unlock this section.

Choosing the bad years leaves us with a problem: we can fit the data better, but why were those years bad? If we don't know the reason, then we're just guessing about whether next year will be good or bad. We haven't learned any information really — we haven't improved our ability to predict the future.

Instead of manually choosing the bad years, it would be better if we had a way to predict the bad years.

Fortunately, moose aren't the only thing they've been counting on Isle Royale! They've also counted the wolves.

Below are the population counts for moose and wolves on the island over the same 42 winters. Now what we can do is tie our moose birth and death rates to the wolf population numbers. Below the graphs is your model. Build it piece by piece.

You want the best fit possible… but the more parameters you have, the harder it is to predict the future with confidence. So as before, we're trying to balance how right we can be about the data in front of us with how confident we are about future, unseen data.

  • Upper plot: the moose. Lower plot: the wolves — 20 in 1959, a peak of 50 in 1980, a usual year around 22.
  • Your marked years from Stage D are gone. In their place is an arrow from the wolves to the moose death rate, and one number: how much a wolf on the island adds to a moose's chance of dying.
  • The wolf arrow reads the counted wolves, not modelled ones.
  • The wolf sliders stay dark until the moose are under 235.
  • Bars: 235 moose, and 7.5 wolves.
moose — typical miss:  |  wolves — typical miss:

Your birth-death model

Controls

0.200
0.200
0.00
0.200
0.200
0.00

To finish the lesson

  • Moose, with the wolf arrow: under 235. not yet
  • Wolves: under 7.5. the wolves are still dark
  • Answer the question below.
Both populations fitted, and the wolves are a reason rather than a marked year.
Draw the second arrow, from the moose to the wolves' birth rate, then sweep its slider all the way across while you watch the wolves' typical miss. What setting makes it smallest?
per wolf per year

R code

d0 <- read.csv("data/clean/isle_royale.csv")d0 <- d0[d0$year <= 2000, ]mb   <- 0.200md   <- 0.200beta <- 0.00   # wolves -> moose deathsM <- numeric(nrow(d0)); M[1] <- d0$moose[1]for (t in 2:nrow(d0))  M[t] <- M[t-1] * (1 + mb - md - beta * d0$wolves[t-1]/50)mean(abs(M - d0$moose))gam <- 0.00   # moose -> wolf birthsW <- numeric(nrow(d0)); W[1] <- d0$wolves[1]for (t in 2:nrow(d0))  W[t] <- W[t-1] * (1 + wb + gam * d0$moose[t-1]/1000 - wd)mean(abs(W - d0$wolves))