Description Usage Arguments Details Value Author(s) References See Also Examples
Low-level function for multivariate Recursive Binary Segmentation (RBS)
1 | segmentByRBS(Y, K, minRegionSize = 2, verbose = FALSE)
|
Y |
A |
K |
The number of change points to find |
minRegionSize |
Regions with less than |
verbose |
A |
This function recrusively looks for the best candidate change point
according to binary segmentation. This is the low-level function. It is
generally advised to use the wrapper doRBS
which also works on
data frames and has a convenient argument stat
.
See jointSeg
for combining recursive binary segmentation with
pruning by dynamic programming (pruneByDP
).
See PSSeg
for segmenting genomic signals from SNP arrays.
Each dimension of the original signal is scaled before segmentation, using
estimateSd
.
A list with elements:
bkp |
A |
rse |
the residual squared error (RSE) for the successive segmentations |
gain |
The gain provided by each breakpoints in terms of difference between RSE |
Morgane Pierre-Jean and Pierre Neuvial
Gey, S., & Lebarbier, E. (2008). Using CART to Detect Multiple Change Points in the Mean for Large Sample. http://hal.archives-ouvertes.fr/hal-00327146/
PSSeg
, jointSeg
, doRBS
,
pruneByDP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | p <- 2
trueK <- 10
len <- 1e4
sim <- randomProfile(len, trueK, 1, p)
Y <- sim$profile
K <- 2*trueK
res <- segmentByRBS(Y, K)
getTpFp(res$bkp, sim$bkp, tol=10, relax = -1) ## true and false positives
cols <- rep(2, K)
cols[1:trueK] <- 3
par(mfrow=c(p,1))
for (ii in 1:p) {
plot(Y[, ii], pch=19, cex=0.2)
abline(v=res$bkp[1:trueK], col= cols)
abline(v=sim$bkp, col=8, lty=2)
}
## NA:s in one dimension at a true breakpoint
jj <- sim$bkp[1]
Y[jj-seq(-10, 10), p] <- NA
res2 <- segmentByRBS(Y, K)
getTpFp(res2$bkp, sim$bkp, tol=10, relax = -1) ## true and false positives
## NA:s in both dimensions at a true breakpoint
Y[jj-seq(-10, 10), ] <- NA
res3 <- segmentByRBS(Y, K)
getTpFp(res3$bkp, sim$bkp, tol=10, relax = -1) ## true and false positives
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.