This function first finds the extrema locations (in time and in scale) of the continuous wavelet transform input. The set of extrema are then subdivided into sets of branches, where each branch represents a collection of extrema that correspond to the same ridge in the CWT time-scale plane. A coarse-to-fine scale strategy is used to identify the members of each branch as follows: (i) a single extremum at the coarsest scale is selected as the start of a given branch, (ii) the closest neighboring extremum in time at the next finest scale is then added to the branch, (iii) step ii is repeated until the smallest scale is reached or an apparent break occurs in the branch across scale, and (iv) steps i-iii are repeated until all extrema have been accounted. A branch is not grown unless the nearest neighbor candidate at the next finest scale is close in time to the last recorded branch member, where 'close' is defined as being less than the current scale of the neighbor candidate. This means that the window in time for admissible neighbor extrema candidates (at the next finest scale) shrinks proportionally with scale. a pruning factor for excluding non-persistent branches. If a branch of connected extrema does not span this number of octaves, it is excluded from the tree. Default: 1. a tolerance vector used to find CWT extrema. This vector must be as long as there are scales in the CWT such that the jth element defines the tolerance to use in finding modulus maxima at the jth scale of the CWT. If not, the last value is replicated appropriately. Default: 0. a character string denoting the type of extrema to seek in the CWT plane. Supported types are 'extrema', 'maxima' and 'minima'. Default: 'maxima'. A point in the CWT W(t,j) is defined as an extremum if |W(t-1,j)| + tol <, |W(t,j)| and |W(t+1,j)| + tol <, |W(t,j)| where tol is a (scale-dependent) tolerance specified by the user. The search algorithm is also adpated to identify plateaus in the data, and will select the the middle of the plateau as a maximum location when encountered. The data |W(t,j)| is first scaled so that its maximum value is 1.0, so the tolerances should be adjusted accordingly. Since the CWT coefficients are (in effect) a result band-pass filtering operations, the large scale coefficients form a smoother curve than do the small scale coefficients. Thus, the tolerance vector allows the user to specify scale-dependent tolerances, helping to weed out undesirable local maxima. It is recommended that the tolerance be set proportional to the scale, e.g., tolerance=C / sqrt(scale) where C is a constant 0 <, C <, 1. The user is also allowed to control the types of peaks to pursue in the CWT plane: extrema, maxima, or minima. The algorithm (described above) is adjusted accordingly. The output object contains a list of sublists, each sublist corresponds to a single branch in the CWT tree and contains the named vectors: integer vector of indices corresponding to the locations in time where the branches terminated as the scale appraoches zero. a binary matrix (of the same dimension as the CWT matrix) containing a 1 where there exists a corresponding extremum value in the CWT plane a numeric vector containing the first scale's CWT coefficients. Statistical analysis of these data are often used as a rough estimate of the (local) noise level(s) in the original time series. a numeric vector containing the sum across time of all extrema values. This data can be used to help automate the selection of scales of interest in the CWT plane. extracts a subset of branches from the tree. For example, to extract branches 2 through 5, use the syntax x[2:5]. To extract branches which terminate near times 0.47, 0.3, and 1.4, use the syntax x[time=c(0.47, 0.3, 1.4)]. To extract all branches which terminate between times 1.2 and 1.5, use the syntax x[range=c(1.2, 1.5)]. plots the WTMM tree. The plot method also supports the following optional arguments (assume that the variable x is an output of the wavCWTTree function): A logical flag. If fit=TRUE, a subset of branches (limited to four) are fit with various linear regression models on a log(|WTMM|) versus log(scale) basis. The models are specified by the optional models argument. This scheme illustrates the process by which exponents are estimated using the WTMM branches. For example, to see the regressions over chains 10 through 13, issue plot(x[10:13], fit=TRUE). Default: FALSE. A vector of character strings denoting the linear models to use in illustring the calculation of exponents. This argumetn is used only if fit=TRUE. Default: c('lm', 'lmsreg', 'ltsreg'). A logical flag. If TRUE, the locations of the (non-pruned and unbranched) extrema are marked in the time-scale plane. Default: FALSE. J.F. Muzy, E. Bacry, and A. Arneodo., “The multifractal formalism revisited with wavelets.', International Journal of Bifurcation and Chaos, 4, 245–302 (1994). Source.