A Probabilistic Approach to Predator-Prey Relationships: Worth All of the Hoo-Ha?

This is part of a larger series of open notebook posts about how food web structure modifies the effects of predator extinctions. For an introduction and list of other posts, see here.

So, in my last post (notebook entry?), I introduced a new framework for understanding how the food web structure of a predator-prey food web can affect the consequences of extinction for the ability of predators to control their prey. Nice, no? But two things stick out. 1) Really? I mean, this is pretty and such, but does this match anything we’ve seen in nature? 2) So…what if we don’t know the precise structure of a food web, but, rather, just some statistical properties, like linkage density, or degree distribution? What’s your fancy theory going to do for us now?

So, keeping our “Master Food Web” in mind, and that we’re zooming on on a particular component, I’ll address those two questions with a little simulation, a little probability math, and hopefully have you convinced, excited for more, and coming up with all of your own spin off ideas. Or, you can show me how I’m full of it.

Let's zoom in on one part of the general food web

First, a quick review for those of you who didn’t commit to memory the discussion from last time. We’re interested in knowing the change in the probability of prey being eaten given some number, E, of predator extinctions. I showed that we can calculate the average probability of extinction for each prey item if we know it’s number of predators (Di for prey item i) and the diversity of predators (Sp) using the density function of the hypergeometric distribution (dh) such that

p(eaten | E) = 1-dh(0; Di, Sp-Di, Sp-E)     (1)

We can then average this over all prey to get the average probability of being eaten for all prey. And, remember, if it’s just predator extinctions we’re concerned with, then the probability of energy getting to the predator trophic level is the same as p(eaten).

Great, so, can we trust this approach? Consider the results of a totally awesome paper by Finke and colleagues where they were able to manipulate diet breadth of three species of parasitoid. Broadly, the found that with all generalists, diversity didn’t matter bupkiss for the control of prey. But with specialists, mixtures of parasitoids were better able to control prey. So, one would predict that as average number of prey consumed per predator increases, the relationship between number of predator species and the probability of prey being eaten should go from being linear to quickly saturating at 1.

So, let’s take three food webs. In web 1, we have all specialists. In web 2, we have one specialist, and two predators that eat two prey. In web 3, we have all generalists.

Based on the insights of Finke et al.’s work, we would predict that in web 1, we should have a nice linear relationship between predator species richness (that’s species left after extinction). In web 2, we should start to see some curvature, as p(eaten) increases at lower levels of predator species richness. And in web 3, the only time we should see a value other than 1 is if there are no predators left – total predator extinction! And, indeed, that’s precisely what we see in the figure below.

And to see this over a much wider range of possible food webs, here’s a figure showing curves for all possible five predator, five prey food webs. I’ve colored the lines for each simulation by linkage density (that’s number of feeding links divided by total number of species). I’m plotting this with E on the x-axis again (brain flip!) for my own clarity. If you want to follow along at home, here’s the simulation code.

As you can see, the higher linkage density, the more quickly saturating the relationship.

Getting Away from Specific Food Web Structures
OK, but, we don’t always know the diet of every single species in a food web. Indeed, we often only know the general statistical properties of a web. Robust though that data may be, how can we incorporate it into our the framework we have here?

Now, Di seems to be the place where statistical properties of a food web may enter the picture. It would be great if we could somehow use the average value of Di, or maybe it’s mean and variance, or the power coefficient, or something. The sticking point is that this is a nonlinear equation, so, Jensen’s inequality says, “Nope!” to just plugging in something in place of Di. However, we can use the knowledge that Di is limited to be equal to or less than Sp, and that Di is discrete. We can then just apply some simple probability math – namely, how to estimate a mean from an arbitrary discrete distribution. Let’s assume that the in-degree distribution of the prey (i.e., their number of predators) follows some statistical distribution, F(D). We can then get the average value of p(eaten) with the following:

p(eaten | E) = 1-sum_{D=1}^{S_{p}}{p(eaten|E, D)F(D)}     (3)

So, as long as you know the degree distribution, the number of predators and prey, you can plug in anything you’d like. Simplicity itself, no? You can also use this approach to solve for other moments, such as the variance or more. I like it. OK, onwards to thinking about prey extinction, and then to more hairy territory.

A Probabilistic Look at Predators, Prey, and Extinctions

This is part of a larger series of open notebook posts about how food web structure modifies the effects of predator extinctions. For an introduction and list of other posts, see here.

To begin tackling the question of “How does the structure of a food web influence the consequences of extinction? let’s begin by thinking about how changes in the number of predator species in a simple 2-level predator-prey food web can influence 1) the probability of prey being eaten and 2) the amount of energy transfered to the predator group. Looking back at our “Master Food Web”, we’re zooming in on, say, the consequences of extinction in group E for group C.

Let's zoom in on one part of the general food web

I’m going to begin by thinking about whether we can solve this problem if we know the specific structure of a food web. Later on, I’ll start talking about working from food web network properties such as degree distribution.

The first thing to realize is that we’re talking about probabilities. What’s the probability of a prey item being eaten? What’s the probability of energy getting to the predator trophic level? It’s this probabilistic thinking that’s at the centerpiece of the framework I’m going to lay out.

A Probabilistic Framework for Food Webs and Predation

Let’s establish some ground rules for this framework. For an arbitrary topology (i.e., network structure), we can calculate the probability of an individual prey species being eaten quite simply. If there are any links between a prey item and any predator, that probability is 1. If there are no links, it is 0. Let’s call this p(eaten). Control of a group of prey species can therefore be described as the average value of p(eaten) across the whole group of prey. If everyone has a predator, it’s 1. If no one has a predator, it’s 0. If half of the species have a predator, it’s 0.5. And one should be able to calculate variance, etc., from that information.

And just like that, we have a new network metric. p(eaten), which, really, is p(connected to the network by an incoming edge) if you want to get technical.

Before we jump into numbers, let’s look at some examples of how this p(eaten) metric works. First, a simple system with 2 predators, 2 prey. One predator eats one prey. One predator eats two prey. What’s the average p(eaten) if 1 predator goes extinct?

The above figure shows 2 different possible configurations. When the generalist is knocked out, one prey item escapes consumption. p(eaten) for that extinction scenario is 1/2. When the specialist is knocked out, neither prey item escapes consumption. p(eaten) is 1. So, what’s the average probability that a prey item will be eaten if 1 predator is going extinct? It’s just the average of results from the two scenarios: 0.75.

To hammer this home, consider the figure below for a three predator, three prey food web with two specialists and one generalists. I’ve drawn all possible configurations for both the 1 predator extinction and the 2 predator extinction scenarios. Underneath each scenario is its p(eaten) and in bold to the left is the average p(eaten) for that number of extinctions.

A Hypergeometric Approach to Predator-Prey Relationships. Whoah. You said Hypergeometric.

OK, so, the framework should be fairly clear at this point. Now, for that arbitrary topology, what will be the probability that a prey item will be eaten if some number, E, predators go extinct? First, we can calculate this for a single prey item, let’s call it prey item i, if we know the number of predators who eat it – the prey in-degree, Di.

Let’s say there are Sp predators. Some number of them, Di, eat a single prey. We want to know the probability that, if E predators go extinct, of those that remain, what is the probability that none of them are predators of our prey item. This is p(not eaten). And then 1-p(not eaten) = p(eaten) for our little prey item.

OK, so, given all of the possible combinations of predator extinctions, what is p(not eaten)? How do we find it?

This is actually a special case of the hypergeometric distribution. Remember it from intro probability and statistics? No? OK. So. Briefly, let’s say you are drawing balls from an urn. Some are white, some are black. What’s the probability, if you draw X balls, that N of them will be black? This can be expressed as dh(N; # black, # white, X) since we’re using the distributions probability density function. If you want to get into the details of it, see here.

In the case of our prey item, N=0 – no predators are left that eat the prey. The number of draws is the number of species left after extinction: Sp-E. Black balls are predators of our prey item (Di), white balls are those that are, well, not. So, the probability that an individual prey item will not be eaten given E extinctions is

p(eaten | E) = 1-dh(0; Di, Sp-Di, Sp-E)   (1)

To determine the average probability that a prey item will be eaten, we just average this over all prey.

And if you want to get all gory with this, we can actually write down a function for the probability of being eaten given E extinctions:

p(eaten | E) = 1 - \overline{ \frac{ {{ S_{p}-D_{i} }\choose{ S_{p}-E }} }{  {{ S_{p} }\choose{ S_{p}-E }} }}

N.B. In putting this together, I’ve also realized that we can use a slightly more intuitive general equation (but the gory details version is uglier). That is, rather than thinking about the probability of having 0 predators left after E extinctions, what is the probability of having all Di predators of a prey item removed by extinction. This is still p(not eaten). And it leads to the following very similar, and potentially more understandable, equation. Any preferences in the peanut gallery?

p(eaten | E) = 1-dh(Di; Di, Sp-Di, E)   (2)

A Last Note on Energy Transfer from Prey to Predators

The nice thing about this averaged function is that it is simultaneously both the average probability that the prey trophic level will be under control by predators and the average probability that energy entering the food web via prey will make its way up to the predator trophic level. Basically, p(prey eaten) = p(energy gets to predator).

A Final Note of Wonder and some R Code

So, the thing that amazes me the most about the results above is that it all hinges on the prey. One actually doesn’t need to know anything about the diet of individual predators. Instead, one only needs to know how many things eat each prey item. This makes the framework easy to code up computationally, and easy to similate, as instead of coming up with all possible adjacency matrices, one can just look at all possible combinations of Di given some number of total predators. To demonstrate how this can be nice, here’s the R code I use to calculate p(eaten):

#Sp is the diversity of the predators
#E is the number of extinctions
#prey.vec is the in-degree (# of predators) of each prey species

pEaten<-function(Sp, E, prey.vec) {
	#see ?dhyper for more on hypergeometric distributions in R
	1-mean(dhyper(prey.vec,prey.vec, Sp-prey.vec, E))

#If you find the 0 predators remaining formulation more intuitive	
pEaten2<-function(Sp.max, E, prey.vec) {
	1-mean(dhyper(0,prey.vec, Sp.max-prey.vec, Sp.max-E))

Great, and thus end-eth the big information boom. This is the kind of thinking that will underlie everything as I move forward, so read and digest this. If there is something that isn't clear, let me know. Once you start to think about the probability of connections, I think it becomes a good bit more transparent. I'll talk validation and generalization to statistical network probabilities in my next post.

#SciFund is OVER!

After 45 days, with $76,230 raised from 1440 people, I am a pretty proud papa.

My own project hit 70% bringing in $4,600 for kelp forest research. While not complete, it funds one full round of sampling trips and a little extra, so, I’m super excited! And now the data from RocketHub and #SciFund participants begins to flow in. Time to start doing some analyses on what worked, what didn’t, and begin to lay out the future of crowdfunding in science!

Food Web Network Structure and Extinction: The Start of an Open Notebook

So, we know that species are going extinct at a pretty stunning rate. Mostly by human activities. The natural question is, will this affect the function of the natural world? You may well say ‘Duh! Of course!’ as a first instinctive pass, but, the issue isn’t so clear cut – will species that survive simply take up the slack? What’s the value of a ‘species’ anyway?

Starting in the late ’90s the field of diversity-function research has tackled this topic, largely using manipulations plant species number. And the results are pretty conclusive – what you change plant diversity, you affect how the natural world works.

But note I said plants.

A bunch of us in the early to mid ‘aughts wondered if changes in the number of top predator species, or herbivores, or intermediate predators, or other species other than plants and algae might also alter the way the natural world worked in an analogous way. Emmett Duffy outlined a number of reasons we could expect changes in diversity at different trophic levels to produce either the same results as changes in plant diversity or maybe not!

So we went out and did the experiments, and found – well, sometimes diversity affected function one way, sometimes another. It all seemed to depend on something about each individual experiment. I was involved in this by examining about whether losses of predator diversity affected the impact of herbivores on their plant or algal prey – so called trophic cascades.

And in looking at the relationship between predator diversity and trophic cascades we really did see every kind of result one could imagine.

Fortunately, there seemed to be some predictability here which can be seen both by comparing different experiments or looking at some of Deborah Finke’s awesome work in a variety of systems. That one could predict the effect of changing levels of diversity if they knew the relative number of omnivores, specialists, or within-trophic level predation (so called intraguild predation). But these insights were all pretty qualitative. There’s no real quantitative guide here as to when diversity will do what.

A head scratcher.

Leaving this, I went off and did some work looking at how climate change may alter the network structure of food webs. And promptly did a palm-to-the-forehead. Food web network ecology has done a brilliant job of deriving metrics to describe the structure of, well, food webs. And the structure of food webs seems to influence the effects of species going extinct on trophic cascades or any other function one would care to measure.

Clearly, these two fields needed to come together.

So this is what I’m doing for my postdoc here at NCEAS. I am slowly but slowly trying to figure out how to link food web network theory with biodiversity-ecosystem function.

A general food web to consider for other entries in this series.

What’s my goal? Simple. Look at the food web to the left. In it, different trophic levels have different colors. But, heck, even within a trophic level, we may split things into finer trophic groups based on their diet and types of interactions – something we do all the time qualitatively (e.g., by saying there’s a brown food web of detritivores and a green food web of consumers of living tissue) and can even now do quantitatively.

What I want to be able to do is say, let’s take this food web. If we know some structural properties of the web, can we then predict the effects of a change in diversity within any trophic group on the flow of energy and control of consumption within the web.

For example, if some number of species go extinct in F, will consumption of A increase or decrease? If some number of species in C go extinct, will G accumulate more or less energy?

I realize this doesn’t take some important things into account – interaction strengths or the abundance of each individual species. I think the former can be folded in later. I’d also note that I am trying a very different approach than qualitative modeling and think that problems of indeterminacy in predictions may be dealt with by using a probabilistic framework from the start. With respect to abundances – I’m hoping the results can translate into predictions of biomass, but, we shall see…

In the coming weeks, I’m going to try and open up my lab notebook, and lay out the theory I’m developing to answer these sorts of questions. I’ll be honest, I’m doing this for myself as much as anything. I have a lab notebook full of scribbles – some blind alleys, some promising leads. Writing it out will force me to focus my arguments and spot weaknesses (or have you spot weaknesses)! I’ve got some of this nailed, and some of it I may stumble around a bit with. And, heck, I’m always game to hear thoughts from the peanut gallery.

As I answer different pieces of the puzzle, I’ll put links to them in this entry. So, let’s start this open notebook and see where it goes!

Pieces of the Puzzle
1) How do changes in predator richness in a 2-level predator prey web affect the probability that prey will be eaten and energy will be transferred to predators?
2) Can we examine how the statistical properties of a predator-prey food web will affect the consequences of extinction, rather than looking at a single specific food web structure?
3) How do changes in prey species richness affect the probability of energy being transfered to predators?

Awww Yeah! Chemical Ecology Music Video Extravaganza!

I’m so excited. It’s one of my favorite times of year. That’s right, it’s time for the Annual Chemical Ecology Music Video Festival! Oh, J. Long, what have your students cooked up this time?

Pure awesomeness, that’s what. This year’s crop features a number of epic ballads, rap superstars, and more. I think I’ll highlight my current two favorites, but you should definitely go check out the whole bunch or go back and revisit last year’s (particularly Under the Boat (featuring K. Hovel)).

First off, we have the Lobster Rock Anthem, about Aplysia californica’s crazy chemical defense (pdf) against lobster predation. I think this group is fantastic – clever lyrics and great style.

And then the award for best costuming goes to…Key Mesograzers. A rhapsody on Hay et al.’s 1987 classic

Great work, all! Can’t wait to see what they cook up next year!

How to Make a Dancing Yeti Crab Video with Music

So, I’ve been getting some questions about how one can make their own Yeti-crabs-dance-to-music video. So here’s a quick guide for the interested folk who haven’t played around with audio or video before but want to try it out. So, here’s what I did, step-by-step, in 9 easy steps. All told, this took me, eh, 5 minutes.

(This is for iMovie, and I’ll link to a few tutorials in case you need them. If you’re on a PC, there’s Windows Movie Maker – Dr. Zen has added instructions in the comments.)

Kiwa puravida from video in Dancing for Food in the Deep Sea: Bacterial Farming by a New Species of Yeti Crab PLoS ONE, 6 (11) http://dx.doi.org/10.1371/journal.pone.0026243

1) Go and read Dancing for Food in the Deep Sea: Bacterial Farming by a New Species of Yeti Crab by Thurber et al. before anything else. You need to get into the yeti-crab mood first. What a fantastic piece!

2) Scroll to the supporting information and download this video. There are two others – one Kiwa puravida harvesting bacteria and another performing some displays. If you want to get adventurous, go with one of those. But really, stick with the original.

3) Open up iMovie. Import the Yeti Crab video as a new event. Then create a new project. Select the whole of the video and drag it into the new project. If you’re going to want to slow it down for a longer audio clip, double click on the video in the project screen to open the clip inspector, and change the speed. 

4) Watch the video a few times. Find the Yeti Crab’s groove thang. If there was a comparable 10 second clip of music that would go with it (or longer, if you want to slow the clip down), what would it be? I was feeling a Calypso vibe. Doctor Zen felt they were doing The Safety Dance. Or maybe they’re clubbing. What do dancing Yeti crabs say to you?

5) Acquire the appropriate music through legal means. I purchased mine in iTunes. Make sure you have it in iTunes, though, for the next step. If your iMovie is older than iMovie ’09, see below before proceeding.

6) Back in iMovie, click on the icon that looks like musical notes. This will open up your sound library – part of which is your iTunes library. Find your new audio clip. Click and drag it onto your movie clip in the project frame. Voila, you have added music to your film. But is it the right part of the song?

7) To sync up your movie with the right section of music that you want, click on the cog on the music track and select Clip Trimmer. Drag the yellow bar at the start of the music to where you want it. The end will auto-adjust. Click done. You may want to trim your video clip or slow it down or speed it up to make sure the music and video sync.

8 ) Now, if you want, futz to your hearts delight. Change where the music starts. Play around with transitions, title screens, whatever. Or don’t.

9) Now upload it to youtube! (You do have a youtube account, right?) There’s a share menu which contains youtube to pipe it right in there. Make sure in the text to include the full citation and that the video was taken by Andrew:

“Thurber, A., Jones, W., & Schnabel, K. (2011). Dancing for Food in the Deep Sea: Bacterial Farming by a New Species of Yeti Crab PLoS ONE, 6 (11) http://dx.doi.org/10.1371/journal.pone.0026243 for more! Video by Andrew R. Thurber.”

That’s it! Now email me your video and then tweet it (if you’re into that sort of thing!) with the #DancingYetiCrabs hashtag and Dr. Zen will add it to this playlist!

And now that you’ve made your first video in imovie, and seen how easy it is, go forth and make others! There are fewer better ways to communicate your science than video!

Dancing Yeti Crabs! Now with a Soundtrack!

ResearchBlogging.orgSeveral years ago, when the Yeti crab, Kiwa hirsuta was first described, the world looked at a crustacean for the first time and went, “AWWWWW!!!”

I mean, how could you know love crabs from the Kiwa genus? They have fuzzy arms! And are adorable! People immediately began paying tribute with plush toys of all manner and even decorative food arrangements.

So what could be better than a plain ole’ Yeti crab?


That’s right – marine ecologist, deep sea biologist, and all around good egg Andrew Thurber has discovered a new species if Yeti crab, Kiwa puravida that appears to be farming methane consuming bacteria living on the hairs on its arms. How does it farm them? It waves its arms around in the air (like it just don’t care!) – er, water – around of methane seeps. Then periodically scrapes the bacteria off of its arms as food. The waving action serves to amp up supply the bacteria with more methane and other compounds that otherwise would be limited due to boundary layer conditions around the crabs hairy arms. And it looks like they’re having a great time doing it. In fact….I couldn’t resist grabbing the creative commons video on the PLoS paper and, um, adding a soundtrack.

(I really really couldn’t resist.)

(OK, maybe I saw him give a talk on this a few months ago, and have been waiting this entire time for it to be published so I could put a soundtrack on this video. Maybe. Maybe definitely.)

OK, ok, aside from this awesome behavior, what I love about this paper is Andrew takes what could have been a neat behavioral observation with a hypothesis that makes a nice just-so story, and then he tackles it with some really hot science. He uses detailed fatty acid and isotope analysis that shows, definitively, that the Yeti crabs are getting their nutrition from the bacteria on their arms. The symbiosis is real and biologically important. It’s a compelling solid story that gives us a new insight onto the unique life that lives in the deep sea.

Moreover, as Thurber writes, if anything, it highlights how little we know about life in the deep sea. If we have only just discovered that Yeti crabs must dance in the deep to make a living, what other fascinating discoveries are out there?

Update: See Doctor Zen’s version Yeti crabs can dance if they want to (Safety Dance). Anyone else want to take a swing at it?

Thurber, A., Jones, W., & Schnabel, K. (2011). Dancing for Food in the Deep Sea: Bacterial Farming by a New Species of Yeti Crab PLoS ONE, 6 (11) DOI: 10.1371/journal.pone.0026243