changepoints: Change-points detected by WBS or BS

Description Usage Arguments Details Value Examples

Description

The function applies user-specified stopping criteria to extract change-points from object generated by wbs or sbs. For object of class 'sbs', the function returns change-points whose corresponding test statistic exceeds threshold given in th. For object of class 'wbs', the change-points can be also detected using information criteria with penalties specified in penalty.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
changepoints(object, ...)

## S3 method for class 'sbs'
changepoints(object, th = NULL, th.const = 1.3,
  Kmax = NULL, ...)

## S3 method for class 'wbs'
changepoints(object, th = NULL, th.const = 1.3,
  Kmax = 50, penalty = c("ssic.penalty", "bic.penalty",
  "mbic.penalty"), ...)

Arguments

object

an object of 'wbs' or 'sbs' class returned by, respectively, wbs and sbs functions

...

further arguments that may be passed to the penalty functions

th

a vector of positive scalars

th.const

a vector of positive scalars

Kmax

a maximum number of change-points to be detected

penalty

a character vector with names of penalty functions used

Details

For the change-point detection based on thresholding (object of class 'sbs' or 'wbs'), the user can either specify the thresholds in th directly, determine the maximum number Kmax of change-points to be detected, or let th depend on th.const.

When Kmax is given, the function automatically sets th to the lowest threshold such that the number of detected change-points is lower or equal than Kmax. Note that for the BS algorithm it might be not possible to find the threshold such that exactly Kmax change-points are found.

When th and Kmax are omitted, the threshold value is set to

th=sigma * th.const* sqrt(2 log(n)),

where sigma is the Median Absolute Deviation estimate of the noise level and n is the number of elements in x.

For the change-point detection based on information criteria (object of class 'wbs' only), the user can specify both the maximum number of change-points (Kmax) and a type of the penalty used. Parameter penalty should contain a list of characters with names of the functions of at least two arguments (n and cpt). For each penalty given, the following information criterion is minimized over candidate sets of change-points cpt:

n/2 log(sigma_k)+ penalty(n,cpt),

where k denotes the number of elements in cpt, sigma_k is the corresponding maximum likelihood estimator of the residual variance.

Value

sigma

Median Absolute Deviation estimate of the noise level

th

a vector of thresholds

no.cpt.th

the number of change-points detected for each value of th

cpt.th

a list with the change-points detected for each value of th

Kmax

a maximum number of change-points detected

ic.curve

a list with values of the chosen information criteria

no.cpt.ic

the number of change-points detected for each information criterion considered

cpt.ic

a list with the change-points detected for each information criterion considered

Examples

 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
#we generates  gaussian noise + Poisson process signal with 10 jumps on average
set.seed(10)
N <- rpois(1,10)
true.cpt <- sample(1000,N)
m1 <- matrix(rep(1:1000,N),1000,N,byrow=FALSE)
m2 <- matrix(rep(true.cpt,1000),1000,N,byrow=TRUE)
x <- rnorm(1000) + apply(m1>=m2,1,sum)

# we apply  the BS and WBS algorithms with default values for their parameters

s <- sbs(x)
w <- wbs(x)

s.cpt <- changepoints(s)
s.cpt

w.cpt <- changepoints(w)
w.cpt

#we can use different stopping criteria, invoking sbs/wbs functions is not necessary  

s.cpt <- changepoints(s,th.const=c(1,1.3))
s.cpt
w.cpt <- changepoints(w,th.const=c(1,1.3))
w.cpt

Example output

$sigma
[1] 1.006217

$th
[1] 4.86204

$no.cpt.th
[1] 7

$cpt.th
$cpt.th[[1]]
[1] 555 268 647  73 732 421 219


$Kmax
[1] 7

$sigma
[1] 1.006217

$th
[1] 4.86204

$no.cpt.th
[1] 7

$cpt.th
$cpt.th[[1]]
[1] 555 268 647  73 732 421 219


$Kmax
[1] 50

$ic.curve
$ic.curve$ssic.penalty
 [1] 1229.71888  650.55995  271.63506  107.64885   71.07910   55.50606
 [7]   40.84121   32.02118   27.55643   32.02112   37.33802   40.44132
[13]   45.53637   51.79466   58.16812   59.89631   65.59345   68.50119
[19]   71.21269   77.08181   83.22950   89.28098   91.67773   98.58633
[25]  105.52695  107.91348  110.83005  117.20743  124.23552  127.10714
[31]  130.12442  132.54164  135.10811  138.19542  142.00726  146.32010
[37]  149.10367  155.38742  158.05004  161.11693  167.48265  172.90659
[43]  176.11467  182.38557  187.87310  194.87468  198.25904  203.63321
[49]  209.51608  214.24121  217.95998

$ic.curve$bic.penalty
 [1] 1229.71888  650.42515  271.36546  107.24445   70.53989   54.83206
 [7]   40.03240   31.07757   26.47802   30.80792   35.99001   38.95851
[13]   43.91876   50.04225   56.28091   57.87430   63.43663   66.20958
[19]   68.78628   74.52059   80.53348   86.45017   88.71211   95.48591
[25]  102.29173  104.54347  107.32523  113.56781  120.46109  123.19792
[31]  126.08040  128.36281  130.79448  133.74700  137.42404  141.60207
[37]  144.25084  150.39979  152.92761  155.85970  162.09061  167.37976
[43]  170.45304  176.58914  181.94186  188.80864  192.05820  197.29757
[49]  203.04564  207.63597  211.21994

$ic.curve$mbic.penalty
 [1] 1229.71888  653.17980  276.58585  114.60994   79.89162   66.26736
 [7]   53.60211   46.44849   43.38724   49.24470   55.62840   60.08725
[13]   66.79693   74.09172   82.17533   84.02413   90.48860   94.30621
[19]   98.54950  105.90396  112.91882  120.29729  122.88255  131.11124
[25]  139.18857  141.72011  144.83205  152.73629  161.29182  164.54423
[31]  167.95201  170.87875  174.41243  178.26585  183.26892  188.41439
[37]  192.08795  199.44997  201.94074  205.96860  213.68523  219.63361
[43]  223.02907  230.19770  236.49529  244.99852  248.23437  254.22465
[49]  261.09697  266.34407  270.53401


$cpt.ic
$cpt.ic$ssic.penalty
[1] 555 268 647  73 732 421 219 612

$cpt.ic$bic.penalty
[1] 555 268 647  73 732 421 219 612

$cpt.ic$mbic.penalty
[1] 555 268 647  73 732 421 219 612


$no.cpt.ic
ssic.penalty  bic.penalty mbic.penalty 
           8            8            8 

$sigma
[1] 1.006217

$th
[1] 3.740031 4.862040

$no.cpt.th
[1] 8 7

$cpt.th
$cpt.th[[1]]
[1] 555 268 647  73 732 421 219 612

$cpt.th[[2]]
[1] 555 268 647  73 732 421 219


$Kmax
[1] 8

$sigma
[1] 1.006217

$th
[1] 3.740031 4.862040

$no.cpt.th
[1] 8 7

$cpt.th
$cpt.th[[1]]
[1] 555 268 647  73 732 421 219 612

$cpt.th[[2]]
[1] 555 268 647  73 732 421 219


$Kmax
[1] 50

$ic.curve
$ic.curve$ssic.penalty
 [1] 1229.71888  650.55995  271.63506  107.64885   71.07910   55.50606
 [7]   40.84121   32.02118   27.55643   32.02112   37.33802   40.44132
[13]   45.53637   51.79466   58.16812   59.89631   65.59345   68.50119
[19]   71.21269   77.08181   83.22950   89.28098   91.67773   98.58633
[25]  105.52695  107.91348  110.83005  117.20743  124.23552  127.10714
[31]  130.12442  132.54164  135.10811  138.19542  142.00726  146.32010
[37]  149.10367  155.38742  158.05004  161.11693  167.48265  172.90659
[43]  176.11467  182.38557  187.87310  194.87468  198.25904  203.63321
[49]  209.51608  214.24121  217.95998

$ic.curve$bic.penalty
 [1] 1229.71888  650.42515  271.36546  107.24445   70.53989   54.83206
 [7]   40.03240   31.07757   26.47802   30.80792   35.99001   38.95851
[13]   43.91876   50.04225   56.28091   57.87430   63.43663   66.20958
[19]   68.78628   74.52059   80.53348   86.45017   88.71211   95.48591
[25]  102.29173  104.54347  107.32523  113.56781  120.46109  123.19792
[31]  126.08040  128.36281  130.79448  133.74700  137.42404  141.60207
[37]  144.25084  150.39979  152.92761  155.85970  162.09061  167.37976
[43]  170.45304  176.58914  181.94186  188.80864  192.05820  197.29757
[49]  203.04564  207.63597  211.21994

$ic.curve$mbic.penalty
 [1] 1229.71888  653.17980  276.58585  114.60994   79.89162   66.26736
 [7]   53.60211   46.44849   43.38724   49.24470   55.62840   60.08725
[13]   66.79693   74.09172   82.17533   84.02413   90.48860   94.30621
[19]   98.54950  105.90396  112.91882  120.29729  122.88255  131.11124
[25]  139.18857  141.72011  144.83205  152.73629  161.29182  164.54423
[31]  167.95201  170.87875  174.41243  178.26585  183.26892  188.41439
[37]  192.08795  199.44997  201.94074  205.96860  213.68523  219.63361
[43]  223.02907  230.19770  236.49529  244.99852  248.23437  254.22465
[49]  261.09697  266.34407  270.53401


$cpt.ic
$cpt.ic$ssic.penalty
[1] 555 268 647  73 732 421 219 612

$cpt.ic$bic.penalty
[1] 555 268 647  73 732 421 219 612

$cpt.ic$mbic.penalty
[1] 555 268 647  73 732 421 219 612


$no.cpt.ic
ssic.penalty  bic.penalty mbic.penalty 
           8            8            8 

wbs documentation built on May 15, 2019, 1:04 a.m.