CalculatePSD: Spectral Density Estimation

Description

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

Usage

1
2
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:

See Also

spectrum, PlotPSD.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## 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)

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.