# Main CBS Algorithm for Change-Point Detection

### Description

This is the main algorithm. It teratively scans for window of arbitrary size where the case and control read depths are different. It continues until a stopping criterion based on mBIC, maximum number of cut, and the statistic at the current segment.

### Usage

1 |

### Arguments

`cases` |
A numeric vector of the case/tumor reads |

`controls` |
A numeric vector of the control/normal reads |

`statistic` |
The statistic to be used. Can be 'binomial','rabinowitz', 'normal', or 'hybrid' |

`grid.size` |
The set of grid sizes for the iterative search. An automatic default can be computed. |

`takeN` |
The number of candidate change points to be added to a temporary set at each grid size |

`maxNCut` |
The maximum number of segmentation steps to perform |

`minStat` |
The minimum statistic value required to continue the segmentation. Can be set to 0 to be ignored. |

`verbose` |
If |

`timing` |
If |

### Details

This algorithm is an use of the Circular Binary Segmentation method. It continues to segment the reads and consider the resulting child regions for further segmentation. It keeps track of the most promising cut in each children, and only the child region with the most significant segmentation is further cut, yielding more children. This is repeated until stopping criteria are met. The four types of statistics are by the use of exact binomial likelihood, score statistic, normal approximation, and an hybrid of normal approximation with binomial likelihood for small windows.

### Value

`tauHat ` |
The change points called |

`statHat ` |
A matrix containing the statistic and its segmentation for the model called |

`relCN ` |
The relative CN computed for each segment between change points |

`timingRes ` |
A list containing the result of the timing of this algorithm |

### Author(s)

Jeremy J. Shen

### References

D. Rabinowitz, IMS Lecture Notes - Monograph Series, Vol. 23, 1994

### See Also

`ScanIterateGrid`

, `ScanBIC`

, `relCNComp`

, `getAutoGridSize`