We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I got:
> fit <- c3co::segmentData(dat, stat = "TCN") Error in Y[-c(n - 2, n - 1, n), , drop = FALSE] : subscript out of bounds
which happens in estimateSd():
estimateSd()
> traceback() 8: estimateSd(Y) 7: sweep(Y, MARGIN = 2, STATS = estimateSd(Y), FUN = "/") 6: segmentByRBS(Y, K, ...) 5: segFUN(Yseg, ...) 4: eval(expr) 3: prof(segFUN(Yseg, ...), doit = profile) 2: jointSeg(Y = dataToSeg[ww, ], method = "RBS", K = 100, modelSelectionMethod = "Birge") 1: segmentData(dat2, stat = "TCN")
This is because estimateSd() assumes there are enough number of data points;
> print(estimateSd) function (y, method = c("Hall", "von Neumann")) { method <- match.arg(method) if (method == "von Neumann") { y <- stats::na.omit(y) dy <- diff(y) Sd <- stats::mad(dy)/sqrt(2) } else if (method == "Hall") { Y <- as.matrix(y) n <- nrow(Y) wei <- c(0.1942, 0.2809, 0.3832, -0.8582) Y1 <- Y[-c(n - 2, n - 1, n), , drop = FALSE] * wei[1] Y2 <- Y[-c(1, n - 1, n), , drop = FALSE] * wei[2] Y3 <- Y[-c(1, 2, n), , drop = FALSE] * wei[3] Y4 <- Y[-c(1, 2, 3), , drop = FALSE] * wei[4] Sd <- sqrt(colMeans((Y1 + Y2 + Y3 + Y4)^2, na.rm = TRUE)) } return(Sd) } <environment: namespace:jointseg>
Return NA_real_ whenever n <= 2 (or give an informative error message).
NA_real_
n <= 2
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I got:
which happens in
estimateSd()
:Troubleshooting
This is because
estimateSd()
assumes there are enough number of data points;Suggestion
Return
NA_real_
whenevern <= 2
(or give an informative error message).The text was updated successfully, but these errors were encountered: