identifyNoisetypes: Identify Noise Types

View source: R/identifyNoisetypes.R

identifyNoisetypesR Documentation

Identify Noise Types

Description

Identify noise types in a matrix row-wise. The noise type is the slope of the frequency versus the spectral density in log-log scale.

Usage

identifyNoisetypes(x, epsilon = 0.2, predef = FALSE, detrend = TRUE,
  pval.threshold = 0.05, smooth = FALSE, df = max(2, log10(ncol(x))),
  permut = FALSE, abund.threshold = 0, groups = c())

Arguments

x

a matrix with objects as rows and time points as columns

epsilon

allowed deviation from the expected slope of 0 for white noise, -1 for pink noise and -2 for brown noise (all rows with a slope below -3 are classified as having black noise)

predef

use predefined slope ranges to determine noise type from the periodogram; overrides epsilon (slope ranges are: black=[-INF,-2.25]; brown=[-1.75, -2.25), pink=(-1.75,-0.5], white=(-0.5,INF])

detrend

remove a linear trend before computing the spectral density (recommended)

pval.threshold

significance threshold for periodogram powerlaw goodness of fit

smooth

instead of fitting a line to the frequency-spectrum power law, fit a spline with function smooth.spline and consider the minimum of its derivative as the slope. In this case, the frequency is no longer required to scale significantly with the spectral density in log-log scale.

df

smooth.spline parameter (degrees of freedom)

permut

permute time points before computing noise types

abund.threshold

minimum sum per row

groups

vector of group assignments with as many entries as x has samples, if non-empty computes frequencies and spectral densities for each group separately and compute noise type on pooled frequencies and spectral densities

Details

Row sums need to be above the given abundance threshold and the spectral density needs to scale significantly with the frequency (p-value below 0.05) in log-log scale. The periodogram is computed with spectrum from the stats package. The function returns a noisetypes object, which groups matrix row indices by noise type. Note that not all rows may be assigned a noise type.

Value

S3 noisetypes object

Examples

N <- 10
ricker.out <- ricker(N,generateA(N),K=rep(0.01,N))
noise <- identifyNoisetypes(ricker.out, abund.threshold=0)
plotNoisetypes(noise)


hallucigenia-sparsa/seqtime documentation built on Jan. 9, 2023, 11:53 p.m.