Learn R Programming

cmpsR (version 0.1.2)

get_ccp: Identify at most one consistent correlation peak (ccp)

Description

If multi segment lengths strategy is being used, at most one consistent correlation peak (ccp) will be found for the corresponding basis segment. If the ccp cannot be identified, return NULL

Usage

get_ccp(ccr_list, Tx = 25)

Value

integer, the position of the ccp if it is identified; NULL otherwise.

Arguments

ccr_list

list, obtained by get_ccr_peaks

Tx

integer, the tolerance zone is +/- Tx

Examples

Run this code
data("bullets")
land2_3 <- bullets$sigs[bullets$bulletland == "2-3"][[1]]
land1_2 <- bullets$sigs[bullets$bulletland == "1-2"][[1]]
x <- land2_3$sig
y <- land1_2$sig

segments <- get_segs(x, len = 50)

# identify the consistent correlation peak when ccf curves are computed
# based on y and segment 7 in 3 different scales;
# the number of peaks identified in each scale are 5, 3, and 1, respectively.
seg_scale_max <- 3
npeaks_set <- c(5,3,1)
outlength <- c(50, 100, 200)

ccr_list <- lapply(1:seg_scale_max, function(seg_scale) {
  get_ccr_peaks(y, segments, seg_outlength = outlength[seg_scale], nseg = 7, 
  npeaks = npeaks_set[seg_scale])
})

get_ccp(ccr_list, Tx = 25)

Run the code above in your browser using DataLab