Forum: open-discussion


RE: Why is the lomb periodogram "renormalized" (twice, apparently)? [ Reply ] By: Constantino Antonio on 2019-12-03 11:56 | [forum:47239] |
Dear Mara, Sorry for the late reply, I've been quite busy these days... Let me try to explain my reasoning. First, recall that the Parseval's theorem states that the energy in time domain matches the energy in Frequency domain, which is usually computed by summing the PSD and dividing by its length. When using the lomb package, the lsp function normalizes the input signal as you noted and therefore, when summing the PSD we obtain half the original length: data("HRVProcessedData") hrd = HRVProcessedData # let's remove Beats so the computations are faster hrd$Beat = hrd$Beat[1:1000, ] rr = hrd$Beat$RR print(length(rr) / sum(lomb::lsp(rr)$power)) # 2.000261 When using HRV, we obtain half of the variance of the signal: hrd = CreateFreqAnalysis(HRVData = hrd) hrd = CalculatePSD(hrd, indexFreqAnalysis = 1, method = "lomb", to = NULL, doPlot = FALSE) spec = hrd$FreqAnalysis[[1]]$periodogram$spec print(var(rr) / sum(spec / length(rr))) # 2.007886 Which makes sense to me, since Lomb only returns half of the power spectrum (due to its symmetry). Hope this helps.Regards |
RE: Why is the lomb periodogram "renormalized" (twice, apparently)? [ Reply ] By: Mara Naegelin on 2019-11-21 13:32 | [forum:47164] |
Dear Mr. Antonio In the lombAdapter function in "R/StationaryFrequencyAnalysis.R", should the spectrum not be renormalized with a factor of "2 * var.RR" instead? In the lomb::lsp function source code, the Lomb spectrum seems to be normalized with 2*variance(RR), which seems to be common. See the source code in https://rdrr.io/cran/lomb/src/R/lspfunctions.R The relevant line is norm <- 1/(2 * var(y)) and later PN <- norm * PN Thanks for your help and kind regards |
RE: Why is the lomb periodogram "renormalized" (twice, apparently)? [ Reply ] By: Constantino Antonio on 2017-02-15 09:26 | [forum:43866] |
Dear Mrs. Houben, The lomb::lsp function returns a normalized spectrum (sums up to 1). We renormalize it so that it sums up to the variance of the RR series for consistency with the other spectral methods present in the package. We hope this helps you. Kind regards. |
Why is the lomb periodogram "renormalized" (twice, apparently)? [ Reply ] By: Rosa Houben on 2017-02-11 14:39 | [forum:43858] |
Hello, I have been wondering in the StationaryFrequencyAnalysis script, line 141-145, the frequency powers returned by lsp( ) are renormalized, according to the comment on line 140. However, the documentation for the lomb::lsp function seems to state that the returned power spectrum is already normalized ("power: a vector containing the normalised power corresponding to scanned frequencies/periods"). Could one of the writers of the package please clarify why this "renormalization" step is needed? It would be greatly appreciated. Kind regards, Rosa Houben |