Learn R Programming

kerSeg (version 1.1)

statint: Compute the test statistics, D and W, for the changed-interval alternatives.

Description

This function provides the test statistics, \(\textrm{D}(t_{1},t_{2})\), \(\textrm{W}(t_{1},t_{2})\), and the weighted \(\textrm{W}(t_{1},t_{2})\) for the changed-interval alternatives.

Usage

statint(K, Rtemp, R0, r1, r2)

Value

Returns a list of test statistics, \(\textrm{D}(t_{1},t_{2})\), \(\textrm{W}(t_{1},t_{2})\), \(\textrm{W}_{r1}(t_{1},t_{2})\), and \(\textrm{W}_{r2}(t_{1},t_{2})\).

Arguments

K

A kernel matrix of observations in the sequence.

Rtemp

A numeric vector of \(k_{i.}\), the sum of kernel values for each row i.

R0

The term \(R_{0}\), defined in the paper.

r1

The constant in the test statistics \(\textrm{Z}_{W,r1}(t_{1},t_{2})\).

r2

The constant in the test statistics \(\textrm{Z}_{W,r2}(t_{1},t_{2})\).

Examples

Run this code
## Sequence : change in the mean in the middle of the sequence.
d = 50
mu = 2
tau = 50
n = 100
set.seed(1)
y = rbind(matrix(rnorm(d*tau),tau), matrix(rnorm(d*(n-tau),mu/sqrt(d)), n-tau))
K = gaussiankernel(y) # Gaussian kernel matrix
R_temp = rowSums(K)
R0 = sum(K)
a = statint(K, R_temp, R0, r1=1.2, r2=0.8)

Run the code above in your browser using DataLab