SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: Frequency Analysis Results [ Reply ]
By: Clara Sayk on 2021-08-02 08:11
[forum:49072]
Thank you for your reply, that makes a lot of sense.

RE: Frequency Analysis Results [ Reply ]
By: Abraham Otero on 2021-07-23 23:41
[forum:49066]
Your code seems to be reinitializing the NightmareData with an empty lost after performing the frequency analysis:

NightmareData <- list()

Hence there is no $FreqAnalysis. And if you jave no "i" variable and there is a single frequency analysis just use the 1 index.

RE: Frequency Analysis Results [ Reply ]
By: Clara Sayk on 2021-07-22 11:30
[forum:49062]
I used 1 as the index when I got this error message about the $ operator as in:

> mean(NightmareData[[1]]$FreqAnalysis[[1]]$HRV)
Error in NightmareData[[1]]$FreqAnalysis :
$ operator is invalid for atomic vectors

But I'm also not sure whether this would yield the correct results if it worked as I want the mean over all results on a parameter / frequency band.

RE: Frequency Analysis Results [ Reply ]
By: Abraham Otero on 2021-07-22 09:30
[forum:49061]
What is de [[i]] index? What is the value of i?

RE: Frequency Analysis Results [ Reply ]
By: Clara Sayk on 2021-07-22 08:53
[forum:49060]
So this problem solved itself, I just forgot to insert a number as an index to the double brackets.
However, another question arose. I want to get the means of the frequency analysis parameters as it is described in chapter 7 of the the Heart Rate Variability Analysis with the R package book.

Morning$HRV[[i]] <-
mean(MorningData[[i]]$FreqAnalysis[[1]]$HRV)
Morning$LF[[i]] <-
mean(MorningData[[i]]$FreqAnalysis[[1]]$LF)
Morning$HF[[i]] <-
mean(MorningData[[i]]$FreqAnalysis[[1]]$HF)
Morning$LFHF[[i]] <-
mean(MorningData[[i]]$FreqAnalysis[[1]]$LFHF)

So I tried to adjust this code to my data and have it running after completing my frequency analysis so that I can get the mean of each variable for each of my files:

## frequency analysis
hrv.data.nm = CreateFreqAnalysis(hrv.data.nm)
hrv.data.nm = CalculatePowerBand( hrv.data.nm , indexFreqAnalysis= 1, size = 300, shift = 30, sizesp = 2048, type = "fourier", ULFmin = 0, ULFmax = 0.03, VLFmin = 0.03, VLFmax = 0.05, LFmin = 0.05, LFmax = 0.15, HFmin = 0.15, HFmax = 0.4 )

PlotPowerBand(hrv.data.nm, indexFreqAnalysis = 1, ymax = 2500, ymaxratio = 1.4)

hrv.data.nm$FreqAnalysis[[1]]

## save results
NightmareData = hrv.data.nm
exists("NightmareData")

##calculate frequency analysis means

NightmareData <- list()
# One index for each of the values of each analyzed record
Nightmare$HRV[[i]] <-
mean(NightmareData[[i]]$FreqAnalysis[[1]]$HRV)
#Nightmare$LF[[i]] <-
mean(NightmareData[[i]]$FreqAnalysis[[1]]$LF)
#Nightmare$HF[[i]] <-
mean(NightmareData[[i]]$FreqAnalysis[[1]]$HF)
#Nightmare$LFHF[[i]] <-
mean(NightmareData[[i]]$FreqAnalysis[[1]]$LFHF)

Maybe it's an indexing mistake again or maybe I'm not accessing my frequency analysis results correctly. Anyway, I keep getting the error "$ operator is invalid for atomic vectors" even though NightmareData is supposed to be a list for which the $ operator is supposed to work. If anyone has suggestions on how to solve this issue, help would be greatly appreciated.

Thanks in advance
Clara

RE: Frequency Analysis Results [ Reply ]
By: Clara Sayk on 2021-07-21 10:36
[forum:49057]
I tried this line of code following the code for frequency analysis:

## frequency analysis
hrv.data.nm = CreateFreqAnalysis(hrv.data.nm)
hrv.data.nm = CalculatePowerBand( hrv.data.nm , indexFreqAnalysis= 1, size = 300, shift = 30, sizesp = 2048, type = "fourier", ULFmin = 0, ULFmax = 0.03, VLFmin = 0.03, VLFmax = 0.05, LFmin = 0.05, LFmax = 0.15, HFmin = 0.15, HFmax = 0.4 )

PlotPowerBand(hrv.data.nm, indexFreqAnalysis = 1, ymax = 2500, ymaxratio = 1.4)
hrv.data.nm$FreqAnalysis[[indexFreqAnalysis]]

But got the error message 'object 'indexFreqAnalysis' not found', which confuses me as 'indexFreqAnalysis'is defined in the two lines of code prior to that. So now I'm confused, esp. since the frequency analysis and plotting work fine.

I'm not too familiar with R and RHRV so maybe it's a simple mistake, but help would be greatly appreciated.

Thanks,

Clara

RE: Frequency Analysis Results [ Reply ]
By: Jen Chan on 2017-08-26 17:03
[forum:45290]
Thanks for your help!

Kind regards,
Jen

RE: Frequency Analysis Results [ Reply ]
By: Constantino Antonio on 2017-08-17 15:46
[forum:45261]
Hi,

You can access the results of any frequency analysis under HRVData$FreqAnalysis[[indexFreqAnalysis]] (where indexFreqAnalysis should be 1,2,3 and
HRVData is the structure containing all the HRV information). The power bands are already expressed in msec ^ 2. For more details, you may read the tutorial under
http://rhrv.r-forge.r-project.org/documentation.html

Kind regards



Frequency Analysis Results [ Reply ]
By: Jen Chan on 2017-08-10 13:55
[forum:45256]
Hi,

Once the Power Band has been calculated with the CalculatePowerBand function and plotted, where are the results of the frequency analysis displayed, or how can I access the results in ms squared?

Thanks

Thanks to:
Vienna University of Economics and Business Powered By FusionForge