est_signal function

Estimate the signal

Estimate the signal

This function estimates the signal in a given data sequence x with change-points at cpt. The type of the signal depends on whether the change-points represent changes in a piecewise-constant or continuous, piecewise-linear signal. For more information see Details below.

est_signal(x, cpt, type = c("mean", "slope"))

Arguments

  • x: A numeric vector containing the given data.
  • cpt: A positive integer vector with the locations of the change-points. If missing, the ID_pcm or the ID_cplm function (depending on the type of the signal) is called internally to extract the change-points in x.
  • type: A character string, which defines the type of the detected change-points. If type = ``mean'', then the change-points represent the locations of changes in the mean of a piecewise-constant signal. If type = ``slope'', then the change-points represent the locations of changes in the slope of a continuous, piecewise-linear signal.

Returns

A numeric vector with the estimated signal.

Details

The data points provided in x are assumed to follow

Xt=ft+σϵt;t=1,2,...,T, X_t = f_t + \sigma\epsilon_t; t = 1,2,...,T,

where TT is the total length of the data sequence, XtX_t are the observed data, ftf_t is a one-dimensional, deterministic signal with abrupt structural changes at certain points, and ϵt\epsilon_t is white noise. We denote by r1,r2,...,rNr_1, r_2, ..., r_N the elements in cpt and by r0=0r_0 = 0 and rN+1=Tr_{N+1} = T. Depending on the value that has been passed to type, the returned value is calculated as follows.

  • For type = ``mean'', in each segment (rj+1,rj+1)(r_j + 1, r_{j+1}), ftf_t for t(rj+1,rj+1)t \in (r_j + 1, r_{j+1}) is approximated by the mean of XtX_t calculated over t(rj+1,rj+1)t \in (r_j + 1, r_{j+1}).
  • For type = ``slope'', ftf_t is approximated by the linear spline fit with knots at r1,r2,...,rNr_1, r_2, ..., r_N minimising the l2l_2 distance between the fit and the data.

Examples

single.cpt.pcm <- c(rep(4,1000),rep(0,1000)) single.cpt.pcm.noise <- single.cpt.pcm + rnorm(2000) cpt.single.pcm <- ID_pcm(single.cpt.pcm.noise) fit.cpt.single.pcm <- est_signal(single.cpt.pcm.noise, cpt.single.pcm$cpt, type = "mean") three.cpt.pcm <- c(rep(4,500),rep(0,500),rep(-4,500),rep(1,500)) three.cpt.pcm.noise <- three.cpt.pcm + rnorm(2000) cpt.three.pcm <- ID_pcm(three.cpt.pcm.noise) fit.cpt.three.pcm <- est_signal(three.cpt.pcm.noise, cpt.three.pcm$pcm, type = "mean") single.cpt.plm <- c(seq(0,999,1),seq(998.5,499,-0.5)) single.cpt.plm.noise <- single.cpt.plm + rnorm(2000) cpt.single.plm <- ID_cplm(single.cpt.plm.noise) fit.cpt.single.plm <- est_signal(single.cpt.plm.noise, cpt.single.plm$cpt, type = "slope")

Author(s)

Andreas Anastasiou, a.anastasiou@lse.ac.uk

  • Maintainer: Andreas Anastasiou
  • License: GPL-3
  • Last published: 2018-03-09

Useful links