Simulate Temporally Autocorrelated Populations

Temporally autocorrelated populations are correlated in their vital rates (growth, death, etc.) from year to year. It is very common for populations, whether they be bacteria, plants, or humans, to be temporally autocorrelated. This poses a challenge for stochastic population modeling, because a temporally correlated population will behave differently from an uncorrelated one. This package provides tools for simulating populations with white noise (no temporal autocorrelation), red noise (positive temporal autocorrelation), and blue noise (negative temporal autocorrelation). The algebraic formulation for autocorrelated noise comes from Ruokolainen et al. (2009) . Models for unstructured populations and for structured populations (matrix models) are available.

Travis_build_status CRAN_version CoverageStatus Download_count


Many populations that change over time are temporally autocorrelated, which means that the random noise in each timestep is correlated to that of the previous timestep. Instead of uncorrelated white noise, these populations are governed by blue noise (negatively autocorrelated) or red noise (positively autocorrelated.)

The colorednoise package allows you to simulate colored noise as well as populations whose behavior is governed by colored noise.


You can install the latest version of colorednoise from github with:



Here are plots of blue- and red-noise populations generated by the matrix_model function.

pop_blue <- matrix_model(
  data = list(
    mean = matrix(c(0.6687097, 0.2480645, 0.6687097, 0.4335484), ncol=2),
    sd = matrix(c(0.34437133, 0.08251947, 0.34437133, 0.10898160), ncol=2),
    autocorrelation = matrix(rep(-0.4, 4), ncol=2)
  ), timesteps = 100, initialPop = c(100, 100)
pop_red <- matrix_model(
  data = list(
    mean = matrix(c(0.6687097, 0.2480645, 0.6687097, 0.4335484), ncol=2),
    sd = matrix(c(0.34437133, 0.08251947, 0.34437133, 0.10898160), ncol=2),
    autocorrelation = matrix(rep(0.4, 4), ncol=2)
  ), timesteps = 100, initialPop = c(100, 100)
ggplot(pop_blue, aes(x = timestep, y = total)) + geom_line(col="blue") + ylim(0, 6000)

ggplot(pop_red, aes(x = timestep, y = total)) + geom_line(col="red") + ylim(0, 6000)


colorednoise 1.0.4

  • Updated to be compatible with tibble v2.0.0

colorednoise 1.0.3

  • matrix_model now has more options for dealing with survival values erroneously set to >1.

colorednoise 1.0.2

  • The Makevars have been tweaked so the package runs on more operating systems and compilers.
  • colorednoise no longer depends on the deprecated package purrrlyr.

colorednoise 1.0.0

  • colorednoise can now execute matrix population models with the matrix_model function, along with its helper functions colored_multi_rnorm, multi_rnorm, and cor2cov.
  • Renamed raw_noise to colored_noise and timeseries to unstructured_pop.
  • The package now has a more extensive testing suite.

colorednoise 0.0.2

  • Recoded the raw_noise and timeseries functions in Rcpp.
  • Changed timeseries to take separate autocorrelation values for survival and fertility.
  • The output variance of survival probabilities in timeseries now reliably matches the input variance.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.0.4 by Julia Pilowsky, 2 months ago

Report a bug at

Browse source code at

Authors: Julia Pilowsky [aut, cre]

Documentation:   PDF Manual  

GPL-3 license

Imports stats, dplyr, purrr, tibble, tidyr

Suggests ggplot2, knitr, rmarkdown, testthat, covr, pkgdown

Linking to Rcpp, RcppArmadillo

See at CRAN