Movement ecology in R

Movement ecology in R from scratch: home ranges, movement paths, hidden Markov states, state-space models for tag error, and step selection, with what each one assumes.

A GPS track is not a record of where an animal went. It is a record of where a tag reported being, at moments the tag chose, with an error that has its own distribution. Everything on this page is an attempt to get from that to a statement about the animal, and every method here differs mainly in which part of the gap it takes seriously.

This page collects every movement tutorial on this site. All of them build the likelihood or the filter by hand in base R, so the assumption doing the work is on the page rather than inside a package.

The scale problem, which comes before the models

Step length and turning angle are not properties of the animal. They are properties of the animal and the fix interval together. Sample the same walk every minute and every hour and you get two different distributions, two different path lengths and two different tortuosities, and neither of them is the true one. This is not a nuisance to be corrected: it means the sampling schedule is part of the model, and it is why the same track can support two contradictory descriptions without either analysis being wrong.

The same logic runs through the rest. A home range is not a fact about the animal either. A minimum convex polygon grows with the number of fixes, and a kernel estimate answers whatever the bandwidth tells it to answer.

Two questions that look like one

Where does the animal go, and what is it doing? The first is space use: an outline, a utilisation surface, a selection ratio between what was used and what was available. The second is behaviour: the same track read as a sequence of hidden states, encamped or transiting, each with its own step and turn distributions.

The hidden Markov model is the standard answer to the second question, and it is honest about something the first question hides: a state is a statistical construct, not an observed behaviour. Add a state and the model will find one. The number of states is a decision, and the label attached to a state is a hypothesis you brought with you.

Observation error is not noise you can smooth away

A Kalman filter separates the path the animal took from the error the tag made, and it does so by assuming a movement model. Change the movement model and the smoothed path changes, which is a fair price as long as it is stated. Two cases break the standard version: irregular or gappy sampling, which wants a continuous-time process rather than a discrete one, and heavy-tailed location error, where a Gaussian filter is dragged off course by outliers that a particle filter simply absorbs.

Selection: available is a choice, not a fact

A resource selection function compares used locations with available ones, and the word “available” is doing enormous work: you decide what the animal could have reached, and your decision sets the answer. Step selection tightens this by asking the question one step at a time, from where the animal actually was, which is a better definition of available. It also produces the recurring honest limit of this whole family: a fitted selection value is relative. It ranks habitats. It is not a probability of use, and nothing in the fit turns it into one.

The tutorials

Space use: where an animal ranges

The path itself

Behaviour: the hidden Markov model

Observation error: state-space models

Choice, step by step

Where this connects

Newsletter

Get new tutorials by email

New R and QGIS tutorials for ecologists, straight to your inbox. No spam; unsubscribe anytime.

By subscribing you agree to receive these emails and confirm your address once. See the privacy policy.