Code Monkey home page Code Monkey logo

psd's People

Contributors

abarbour avatar jkennel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

psd's Issues

Preprocessing flags

The preprocessing flags are not reflective of the actual preprocessing in the final product, e.g., in the title of the plot.spec method.

request for functionality to judge whether a sequence is chaotic

For a 1D map can we have some functions to return a boolean value (TRUE or FALSE)
the function may be named

is.chaotic()

or

is.quasiPeriodical()

Judging by width of 'peaks' might work. A better idea may be to calculate square of errors when fitting a smoothed (e.g. linear) model to the P[dB] ~ log(frequency) plot.
Is this achievable?

Discrepancy in (number of) frequencies between psd::pspectrum vs stats::spectrum (and others)

Thanks a lot for releasing the multivariate support for psd. Incorporating this into ForeCA was straightforward as psd returns the 3D array power spectra. However, I am running into a subtle inconsistency in the calculated frequencies of the periodogram. psd::pspectrum frequencies differ from various other packages including the baseline stats::spectrum. I am aware that different implementations handle frequency 0 and the (a)symmetry of frequencies around 0 differently (returning only the non-negative side of the spectrum). However, it seems that psd frequencies are actually computed with a different denominator ([n/2]-1) compared to other implementations ([n+1 / 2] - 1?).

The psd spectra still are great estimates for ForeCA, it's just that if possible I'd like to avoid the discrepancy in the first place as the psd::pspectrum return values have a lower dimensional shape compared to various other spectrum estimates (sapa::SDF, astsa::mvspec and stats::spectrum all agree on the (number of) frequencies).

Is there any way to pass a flag to psectrum so it calculates according to same frequencies as seen in other implementations? The only hacky solution I can think of is to add a row of 0s to the data and compute pspectrum on that augmented dataset.

See below for a reproducible example

set.seed(10)
library(astsa)
library(psd)

nn <- 20  # also try 18 for odd number of observations; guess related to the [(n-1)/2] - 1 vs [n/2] - 1 discrepancy
X <- matrix(rnorm(nn), ncol = 2)

num_non_zero_freqs <- function(freqs) {
  print(c(length(freqs), length(freqs[freqs > 0])))
  return(freqs)
}

num_non_zero_freqs(psd::pspectrum(X)$freq)
# hacky fix to make pspectrum output consistent
num_non_zero_freqs(psd::pspectrum(rbind(0, X, 0), ntap.init=3, Nyquist.normalize=TRUE)$freq)
num_non_zero_freqs(stats::spectrum(X)$freq)
num_non_zero_freqs(astsa::mvspec(X)$freq)

Bogus first/last estimates

The first and last values of the spectra are strangely very low. The solution thus far is to extrapolate values, which is precarious; however, those points are very nearly useless for most applications of power spectral density estimates.

See ?psdcore

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.