Learn R Programming

Segmentor3IsBack (version 2.0)

SelectModel: SelectModel

Description

This function is used to select the number of segments in the segmentation of the data according to several criterion including BIC, AIC, mBIC and oracle penalties.

Usage

SelectModel(x,penalty="oracle",seuil=n/log(n),keep=FALSE,greatjump=FALSE)

Arguments

x
An object of class Segmentor returned by function Segmentor
penalty
An object of class string stating which penalty to use in the model selection criteria. Accepted penalties are BIC, AIC, Zhang's modified BIC: mBIC and oracle penalties: 'oracle'. In the case of Normal segmentation, criterion developed by Lebarbier, in the case of Poisson and Negative Binomial segmentation, criterion developed by Cleynen and Lebarbier. Default is oracle
seuil
If penalty='oracle', an Integer for the threshold to use for the slope heuristic. Default value is n/log(n)
keep
A Boolean stating whether or not to keep the values of the criterion. Default is FALSE.
greatjump
If penalty is "oracle", a boolean stating whether to use the greatest jump (TRUE) or the threshold for the slope heuristic. Default is FALSE.

Value

K
The number of segments selected.
crit
If keep=TRUE, a vector of criterion value for each possible K.

Details

Package:
Segmentor3IsBack
Type:
Package
Version:
1.5
Date:
2013-03-25
License:
GPL (>= 2)

References

PDPA: Rigaill, G. Pruned dynamic programming for optimal multiple change-point detection: Submitted http://arxiv.org/abs/1004.0887

PDPA: Cleynen, A. and Koskas, M. and Lebarbier, E. and Rigaill, G. and Robin, S. Segmentor3IsBack (2014): an R package for the fast and exact segmentation of Seq-data Algorithms for Molecular Biology

overdispersion parameter: Johnson, N. and Kemps, A. and Kotz, S. (2005) Univariate Discrete Distributions: John Wiley & Sons Selection criterion for counts: Cleynen, A. and Lebarbier, E. (2014) Segmentation of the Poisson and negative binomial rate models: a penalized estimator: ESAIM: Probability and Statistics Selection criterion for Gaussian distribution: Lebarbier, E. (2005) Detecting multiple change-points in the mean of Gaussian process by model selection: Signal Processing Slope heuristic: Arlot, S. and Bach, F. (2009) Data-driven calibration of penalties for least-squares regression: Journal of Machine Learning Research modified BIC: Zhang, N. and Siegmund, D. (2007) A modified Bayes information criterion with applications to the analysis of comparative genomic hybridization data: Biometrics

Examples

Run this code
require(Segmentor3IsBack);
N=2000 
x=rnbinom(5*N, size=1.3, prob=rep(c(0.7,0.2,0.01,0.2,0.8),each=N))
res=Segmentor(data=x,model=3,Kmax=20);  
# Finds the optimal segmentation in up to 20 segments with respect to 
#the negative binomial model.
Cr<-SelectModel(res,penalty='oracle',keep=FALSE)
Cr
#chooses the number of segments in the segmentation of x using
# an oracle-inequality approach

N=250 
x=rpois(10*N, rep(c(8,1,5,3,16,33,2,12,7,1),each=N))
res=Segmentor(data=x,model=3,Kmax=40);  
# Finds the optimal segmentation in up to 40 segments with respect to 
#the poisson model.
Cr<-SelectModel(res,penalty='BIC',keep=FALSE)
Cr
#chooses the number of segments in the segmentation of x using
# the BIC approach

Run the code above in your browser using DataLab