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.
Returns
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
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.
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 methodHRVData=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 resultslayout(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)