Learn R Programming

gSeg (version 0.1)

gseg1: Graph-Based Change-Point Detection for Single Change-Point

Description

This function finds a break point in the sequence where the underlying distribution changes.

Usage

gseg1(n, E, n0=0.05*n, n1=0.95*n, pval.appr=TRUE, skew.corr=TRUE, pval.perm=FALSE, B=100)

Arguments

n
The number of observations in the sequence.
E
The edge matrix (a "number of edges" by 2 matrix) for the similarity graph. Each row contains the node indices of an edge.
n0
The starting index to be considered as a candidate for the change-point.
n1
The ending index to be considered as a candidate for the change-point.
pval.appr
If it is TRUE, the function outputs p-value approximation based on asymptotic properties.
skew.corr
This argument is useful only when pval.appr=TURE. If skew.corr is TRUE, the p-value approximation would incorporate skewness correction.
pval.perm
If it is TRUE, the function outputs p-value from doing B permutations, where B is another argument that you can specify. Use this argument with caution that it may take long time to finish the permutation.
B
This argument is useful only when pval.perm=TRUE. The default value for B is 100.

Value

  • tauhatAn estimate of the location of the change-point.
  • ZmaxThe test statistic (maximum of the scan statistics).
  • ZA vector of scan statistics (standardized counts).
  • RA vector of raw counts.
  • pval.apprThis output exists only when the argument pval.appr is TRUE. The approximated p-value.
  • pval.permThis output exists only when the argument pval.perm is TRUE (same for perm.curve, perm.maxZs, and perm.Z). p-value calculated from B permutations.
  • perm.curveA B by 2 matrix with the first column being critical values corresponding to the p-values in the second column.
  • perm.maxZsA sorted vector recording the test statistics in the B permutaitons.
  • perm.ZA B by n matrix with each row being the scan statistics from each permutaiton run.

See Also

gseg2

Examples

Run this code
data(Example) # this example data has: n (the number of observations) and E (an edge matrix)
r1 = gseg1(n,E)

Run the code above in your browser using DataLab