PlotPSD {RHRV} | R Documentation |
Plot Spectral Density Estimation
Description
Plot the PSD estimate of the RR time series distinguishing the different frequency bands with different colurs.
Usage
PlotPSD(HRVData, indexFreqAnalysis = length(HRVData$FreqAnalysis),
ULFmin = 0, ULFmax = 0.03, VLFmin = 0.03, VLFmax = 0.05,
LFmin = 0.05, LFmax = 0.15, HFmin = 0.15, HFmax = 0.4, log = "y",
type = "l", xlab = "Frequency (Hz) ", ylab = "Spectrum", main = NULL,
xlim = c(min(ULFmin, ULFmax, VLFmin, VLFmax, LFmin, LFmax, HFmin, HFmax),
max(ULFmin, ULFmax, VLFmin, VLFmax, LFmin, LFmax, HFmin, HFmax)),
ylim = NULL, addLegend = TRUE, addSigLevel = TRUE,
usePalette = c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442"), ...)
Arguments
HRVData |
Data structure that stores the beats register and information related to it. |
indexFreqAnalysis |
An integer referencing the data structure that contains the PSD analysis. |
ULFmin |
Lower limit ULF band used for distinguish the ULF band. |
ULFmax |
Upper limit ULF band used for distinguish the ULF band. |
VLFmin |
Lower limit VLF band. |
VLFmax |
Upper limit VLF band. |
LFmin |
Lower limit LF band. |
LFmax |
Upper limit LF band. |
HFmin |
Lower limit HF band. |
HFmax |
Upper limit HF band. |
log |
a character string which contains "x" if the x axis is to be logarithmic, "y" if the y axis is to be logarithmic and "xy" or "yx" if both axes are to be logarithmic. Default: "y". |
type |
1-character string giving the type of plot desired. See |
xlab |
a label for the x axis. See |
ylab |
a label for the y axis. See |
main |
a main title for the plot. See |
xlim |
the x limits (x1, x2) of the plot. See |
ylim |
the y limits of the plot. |
addLegend |
add a simple legend? Default: True. |
addSigLevel |
Logical value (only used with the lomb method). If true an
horizontal line limiting the significance level is included ( Powers >
sig.level can be considered significant peaks). See |
usePalette |
A new palette of colors for plotting the frequency bands. |
... |
graphical parameters. See |
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=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)