Forum: open-discussion
Monitor Forum | | Poincare plot confidence [ Reply ] By: Toru Hitomi on 2024-03-01 13:33 | [forum:49847] |
|
Hi, I've read source codes for Poincare plot (RHRV, v4.2.7 from https://rdrr.io/cran/RHRV/src/R/poincarePlot.R) and found something unclear to me. Basically the PoincarePlot function has arguments regarding the confidence level spec (`confidenceEstimation` and `confidence`). confidenceEstimation is just a boolean to decide if confidence is estimated or not. The thing I want to know is about `confidence`, which seems to specify the confidence level (Default: 0.95). Specifically, the confidence argument is passed to the computeSD() and then confidenceEllipse() function: [In PoincarePlot] SD = computeSD(timeSeries = rrSeries, timeLag = timeLag, confidenceEstimation = confidenceEstimation, confidence = confidence) [In computeSD] if (confidenceEstimation) { takens = buildTakens(time.series = timeSeries, embedding.dim = 2, time.lag = timeLag) SD = confidenceEllipse(x = takens[, 1], y = takens[, 2], confidence = confidence) } [In confidenceEllipse] confidenceEllipse <- function(x,y, confidence=0.95){ # Get covariance matrix and mean point covMatrix = cov(cbind(x,y)) # Compute eigenvalues and eigenvectors eigenComputations = eigen(covMatrix) eigenvalues = eigenComputations$values eigenvectors = eigenComputations$vectors # rotate eigenvectors to obtain "usual" directions # first eigenvector must have all components > 0 if ( (eigenvectors[1,1]*eigenvectors[1,2]) < 0) { rotationMatrix = matrix(c(-1,0,0,-1), ncol = 2, byrow = FALSE) eigenvectors = rotationMatrix %*% eigenvectors } return(list(sd = sqrt(eigenvalues), directions = eigenvectors)) } However, if you carefully look at the confidenceEllipse function, the function receives confidence level argument but doesn't use it at all. My questions are: 1. Is this a bug? 2. When you calculate confidence estimation, the argument `confidence` won't be used? I hope that my description makes sense and welcome any suggestions or comments. Best regards, Toru |
|

