Learn R Programming

wbs (version 1.4)

means.between.cpt: Means between change-points

Description

The function finds the average of the input vector x between change-points given in cpt.

Usage

means.between.cpt(x, cpt = NULL, ...)

Arguments

x

a vector

cpt

a vector of integers with localisations of change-points

...

further arguments passed to mean method

Value

a vector of the same length as x, piecewise constant and equal to the mean between change-points given in cpt

Examples

Run this code
# NOT RUN {
x <- rnorm(100)+c(rep(-1,50),rep(1,50))
cpt <- 50
means.between.cpt(x,cpt)
w <- wbs(x)
cpt <- changepoints(w)
means.between.cpt(x,cpt=cpt$cpt.ic$sbic)
# }

Run the code above in your browser using DataLab