Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

CalculatePSD

Spectral Density Estimation


Description

Estimate the Power Spectral Density (PSD) of the RR time series.

Usage

CalculatePSD(HRVData, indexFreqAnalysis = length(HRVData$FreqAnalysis),
  method = c("pgram", "ar", "lomb"), doPlot = T, ...)

Arguments

HRVData

Data structure that stores the beats register and information related to it.

indexFreqAnalysis

An integer referencing the data structure that will contain the frequency analysis.

method

String specifying the method used to estimate the spectral density. Allowed methods are "pgram" (the default), "ar" and "lomb".

doPlot

Plot the periodogram?

...

Further arguments to specific PSD estimation methods or PlotPSD.

Details

The "pgram" and "ar" methods use the spec.pgram and spec.ar functions. Thus, the same arguments used in spec.pgram or spec.ar can be used when method is "pgram" or "ar", respectively. The "lomb" is based in the lsp and thus it accepts the same parameters as this function.

Value

The CalculatePSD returns the HRVData structure containing a periodogram field storing and PSD estimation of the RR time series. When the "pgram" and "ar" methods are used the periodogram field is an object of class "spec". If "lomb" is used, the periodogram field is just a list. In any case the periodogram field will contain:

  • freq: vector of frequencies at which the spectral density is estimated.

  • spec: spectral density estimation

  • series: name of the series

  • method: method used to calculate the spectrum

See Also

Examples

## Not run: 
data(HRVData)
HRVData=BuildNIHR(HRVData)
HRVData=FilterNIHR(HRVData)
# Frequency analysis requires interpolated data (except Lomb)
HRVData=InterpolateNIHR(HRVData)
# Create a different freqAnalysis for each method
HRVData=CreateFreqAnalysis(HRVData)
HRVData=CalculatePSD(HRVData,1,"pgram",doPlot = F)

HRVData=CreateFreqAnalysis(HRVData)
HRVData=CalculatePSD(HRVData,2,"pgram",spans=9, doPlot = F)

HRVData=CreateFreqAnalysis(HRVData)
HRVData=CalculatePSD(HRVData,3,"ar",doPlot = F)

HRVData=CreateFreqAnalysis(HRVData)
HRVData=CalculatePSD(HRVData,4,"lomb",doPlot = F)
# Plot the results
layout(matrix(c(1,2,3,4), 2, 2, byrow = TRUE))
PlotPSD(HRVData,1)
PlotPSD(HRVData,2)
PlotPSD(HRVData,3)
PlotPSD(HRVData,4)

## End(Not run)

RHRV

Heart Rate Variability Analysis of ECG Data

v4.2.6
GPL-2
Authors
Leandro Rodriguez-Linares [aut, cre], Xose Vila [aut], Maria Jose Lado [aut], Arturo Mendez [aut], Abraham Otero [aut], Constantino Antonio Garcia [aut], Matti Lassila [ctb]
Initial release
2020-12-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.