Perry de Valpine, Kim Cuddington, Martha F. Hoopes, and Julie L. Lockwood. 2008. Is spread of invasive species regulated? Using ecological theory to interpret statistical analysis. Ecology 89:2377–2383.


R code for illustrating that standard linear regression is not valid for testing random walk null hypotheses for autoregressive time series.
Ecological Archives


File list (downloads)


Perry de Valpine
Environmental Science, Policy and Management, University of California, Berkeley
173 Mulford #3114, Berkeley CA 94720-3114


Kim Cuddington
Department of Biological Sciences, Ohio University
Athens, OH 45701

Martha F. Hoopes
Biological Sciences, Mt. Holyoke College
50 College Street, South Hadley, MA 01075

Julie L. Lockwood
Ecology, Evolution and Natural Resources, Rutgers University
14 College Farm Road, New Brunswick NJ 08901

File list



This code illustrates an aspect of time-series analysis that has been recognized for a long time but may be unfamiliar to some readers. The null hypothesis of no density-dependence in a population time-series, often called a random walk, can be represented as no relationship between log abundance at one time and the difference in log abundance from that time to the next time. However, the standard linear regression test of the hypothesis of a zero slope between two variables is not valid for testing the null hypothesis of a random walk in a time series. The code provided here uses simulations to illustrate that using standard linear regression to attempt to test a random walk null hypothesis leads to an incorrect probability of rejecting the null hypothesis even when it is true, i.e., Type I error rate. This code is provided for educational purposes.

deValpine_etal_invasions_supplement_randomWalkCode.R contains annotated code comparing valid use of a linear regression hypothesis test to invalid use of such a test for a random walk null hypothesis for a time-series.

ESA Publications | Ecological Archives | Permissions | Citation | Contacts