R package for simulating and analyzing temporally autocorrelated populations.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R Package updated to be compatible with tibble 2.0.0. Changes to Makeva… Jan 23, 2019
docs Added pkgdown website. Aug 16, 2018
man Updated code in matrix_model to reflect changes in tibble 2.0.0 Nov 30, 2018
src Package updated to be compatible with tibble 2.0.0. Changes to Makeva… Jan 23, 2019
tests Added pkgdown website. Aug 16, 2018
vignettes Updated vignette to include bias correction of autocorrelation estima… Mar 22, 2018
.Rbuildignore Package updated to be compatible with tibble 2.0.0. Changes to Makeva… Jan 23, 2019
.gitattributes Added some configuration files to turn off OpenMP on systems that don… Mar 7, 2018
.gitignore Instructed Travis CI to auto-generate new pkgdown site. Aug 20, 2018
.travis.yml Instructed Travis CI to auto-generate new pkgdown site. Aug 20, 2018
CRAN-RELEASE Package updated to be compatible with tibble 2.0.0. Changes to Makeva… Jan 23, 2019
DESCRIPTION Package updated to be compatible with tibble 2.0.0. Changes to Makeva… Jan 23, 2019
NAMESPACE Updated code in matrix_model to reflect changes in tibble 2.0.0 Nov 30, 2018
NEWS.md Package updated to be compatible with tibble 2.0.0. Changes to Makeva… Jan 23, 2019
README.Rmd Added code coverage tracking. Mar 7, 2018
README.md Added code coverage tracking. Mar 7, 2018
codecov.yml Added code coverage tracking. Mar 7, 2018
colorednoise.Rproj Creating a R package out of my colored noise code. Sep 16, 2017
cran-comments.md Last cleanups for submission of 1.0.3 to CRAN May 31, 2018

README.md

colorednoise

Travis_build_status CRAN_version Coverage Status Download_count

Overview

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.

Installation

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

# install.packages("devtools")
devtools::install_github("japilo/colorednoise")

Example

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

library(colorednoise)
set.seed(7927)
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)