Learn R Programming

samplr (version 1.0.1)

calc_PSD: Power Spectral Density Calculator

Description

This function estimates the log power spectral density against the log frequency, and calculates a slope \(\alpha\).

Usage

calc_PSD(chain, plot = FALSE)

Value

Returns a list with log frequencies, log PSDs, and slope and intercept estimates.

Arguments

chain

Matrix of n x d dimensions, n = iterations, d = dimensions sequence

plot

Boolean. Whether to return a plot or the elements used to make it.

Details

A number of studies have reported that cognitive activities contain a long-range slowly decaying autocorrelation. In the frequency domain, this is expressed as \(S(f)\) ~ \(1/f^{-\alpha}\), with \(f\) being frequency, \(S(f)\) being spectral power, and \(\alpha\) \(\epsilon\) \([0.5,1.5]\) is considered \(1/f\) scaling. See See zhu2018MentalSamplingMultimodal;textualsamplr for a comparison of Levy Flight and PSD measures for different samplers in multimodal representations.

References

Examples

Run this code
set.seed(1)
chain1 <- sampler_mh(1, "norm", c(0,1), diag(1))
calc_PSD(chain1[[1]], plot= TRUE)

Run the code above in your browser using DataLab