Learn R Programming

gSeg (version 0.3)

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

tauhat

An estimate of the location of the change-point.

Zmax

The test statistic (maximum of the scan statistics).

Z

A vector of scan statistics (standardized counts).

R

A vector of raw counts.

pval.appr

This output exists only when the argument pval.appr is TRUE. The approximated p-value.

pval.perm

This 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.curve

A B by 2 matrix with the first column being critical values corresponding to the p-values in the second column.

perm.maxZs

A sorted vector recording the test statistics in the B permutaitons.

perm.Z

A B by n matrix with each row being the scan statistics from each permutaiton run.

See Also

gseg2

Examples

Run this code
# NOT RUN {
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