SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: Error in plot.window(...) : need finite 'xlim' values [ Reply ]
By: Constantino Antonio on 2019-03-27 16:42
[forum:46630]
Dear Atanackov,

Sorry for the late reply. I finally found some time to look at your code.

The problem for me arises with the CalculateCorrDim, which is just returning an empty correlation matrix. This implies that the function can't find any neighbors in the neighborhoods specified by your minRadius and maxRadius. You should increase both. I start finding neighbours with a radius of 20 (approx).

Of course, the larger the series, the easier it is to find some neighbor. That's the reason why the code may work with 400 samples and not with 300.

Hope this helps.

Kind regards

RE: Error in plot.window(...) : need finite 'xlim' values [ Reply ]
By: Peter Atanackov on 2019-03-14 14:08
[forum:46613]

RRa.Rmd (12) downloads
Thank you very much for your reply Constantino, unfortunately that didn't fix my problem. I used na.omit() for that very purpose. Attached is the full code if you'd care to try it out, it should work without modifications.

The script reads every column in the CSV file and analyzes the first 300 seconds, the middle 300 seconds and the last 300 seconds of the whole RR sequence. Because that didn't work and my previus analysis of the same data where I anlyzed 600 seconds of the RR sequence worked, I tried lenghtening the analyzed time segment. It starts working at a lenght of 400 seconds.

You can see where I tried various periods, I replaced the "end" variable with numbers between 300 and 600, it's is commented. It works for 400, but not 300 seconds.

RE: Error in plot.window(...) : need finite 'xlim' values [ Reply ]
By: Constantino Antonio on 2019-03-06 13:42
[forum:46599]
Hi,

I am not able of reproducing your error, although I had to preprocess the csv you have attached to import it properly: maybe is this the source of the issue?

If you import the CSV into R and then pick the second column, there will be NAs at the
end of the vector (this is because the last column is much larger than the others). After removing the NAs I had no issues with your code

Hope this helps
Regards

Error in plot.window(...) : need finite 'xlim' values [ Reply ]
By: Peter Atanackov on 2019-02-26 11:58
[forum:46554]

RR.csv (23) downloads
Greetings,

i've been using hrv and enjoying it, it's a really good package, the only problem I've been having with it is that it doesn't seem to want to analyze recording segments that are shorter than 400s if I use 300s windows. This isn't always the case it just happens with specific recordings and gives the above mentioned error.

In the attached CSV file for instance it doesn't want to analyze te second column.

Thank you very much for any help.

This is the function I use to analyze the recordings:

```{r setup, include=FALSE}
analiza <- function(hrv_podatki) {

spectral_analysis <- CreateFreqAnalysis(hrv_podatki)
spectral_analysis <- CalculatePowerBand(spectral_analysis , indexFreqAnalysis= 1,
size = 300, shift = 30, 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 )

timedomain_analysis <- CreateTimeAnalysis(hrv_podatki, size = 300)

nonlinear_analysis <- CreateNonLinearAnalysis(hrv_podatki)
nonlinear_analysis <- CalculateCorrDim(nonlinear_analysis,
indexNonLinearAnalysis = 1,
minEmbeddingDim = 2,
maxEmbeddingDim = 8, timeLag = 1,
minRadius = 1, maxRadius = 15,
pointsRadius = 20, theilerWindow = 10,
corrOrder = 2, doPlot = FALSE)

nonlinear_analysis <- CalculateSampleEntropy(nonlinear_analysis)
nonlinear_analysis <- EstimateSampleEntropy(nonlinear_analysis)
nonlinear_analysis <- PoincarePlot(nonlinear_analysis)


SDNN <- timedomain_analysis$TimeAnalysis[[1]]$SDNN
SDANN <-timedomain_analysis$TimeAnalysis[[1]]$SDANN
SDNNIDX <-timedomain_analysis$TimeAnalysis[[1]]$SDNNIDX
SDSD <- timedomain_analysis$TimeAnalysis[[1]]$SDSD
pNN50 <- timedomain_analysis$TimeAnalysis[[1]]$pNN50
rMSSD <- timedomain_analysis$TimeAnalysis[[1]]$rMSSD
IRRR <-timedomain_analysis$TimeAnalysis[[1]]$IRRR
MADRR <- timedomain_analysis$TimeAnalysis[[1]]$MADRR
TINN <- timedomain_analysis$TimeAnalysis[[1]]$TINN
HRVi <- timedomain_analysis$TimeAnalysis[[1]]$HRVi

HRV <- mean(spectral_analysis$FreqAnalysis[[1]]$HRV)
LF <- mean(spectral_analysis$FreqAnalysis[[1]]$LF)
HF <- mean(spectral_analysis$FreqAnalysis[[1]]$HF)
LFHF <- mean(spectral_analysis$FreqAnalysis[[1]]$LFHF)

entropy <- mean(nonlinear_analysis$NonLinearAnalysis[[1]]$sampleEntropy$statistic) # tukaj sem dal mean ker drugače ne vem kaj naredit s temi 6 vrednosti.
SD1 <- nonlinear_analysis$NonLinearAnalysis[[1]]$PoincarePlot$SD1
SD2 <- nonlinear_analysis$NonLinearAnalysis[[1]]$PoincarePlot$SD2

hrv_results_table <- c(SDNN, SDANN, SDNNIDX, SDSD,pNN50, rMSSD, HRVi, MADRR, TINN, HRV, LF, HF, LFHF, entropy, SD1, SD2)

hrv_results_table_DF <- data.frame(hrv_results_table)
hrv_results_table_DF <- hrv_results_table_DF %>% `row.names<-`(c("SDNN","SDANN", "SDNNIDX", "SDSD", "pNN50","r-MSSD","HRVi", "MADRR", "TINN", "HRV", "LF", "HF", "LF/HF", "Sample entropy", "Poincare SD1", "Poincare SD2"))
hrv_results_table_DF <- round_df(hrv_results_table_DF,2)
name.width <- max(sapply(names(hrv_results_table_DF), nchar))

return(hrv_results_table_DF)

}





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