plot_PSD: Power Spectral Density Plotter

Description Usage Arguments Details Value Examples

View source: R/plotters.R

Description

This function plots the log power spectral density against the log frequency, and calculates a slope α.

Usage

1
plot_PSD(chain, plot = TRUE)

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^{-α}, with f being frequency, S(f) being spectral power, and α ε [0.5,1.5] is considered 1/f scaling. See Zhu et al. 2018 for a comparison of Levy Flight and PSD measures for different samplers in multimodal representations.

Value

If plot is, it returns a simple plot with the log PSD against the log frequency, as well as an estimate for the α parameter. If false it returns a list with what's required to make the plot.

Examples

1
2
3
4
target <- distr::Norm()
pd_func <- make_distr_pdf(target)
chain1 <- sampler_mcmc(pd_func, 0, sigma_prop = 1)
plot_PSD(chain1[[1]])

lucas-castillo/SampleR documentation built on Jan. 1, 2021, 8:25 a.m.