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,
where T is the total length of the data sequence, Xt are the observed data, ft is a one-dimensional, deterministic signal with abrupt structural changes at certain points, and ϵt is white noise. We denote by r1,r2,...,rN the elements in cpt and by r0=0 and rN+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), ft for t∈(rj+1,rj+1) is approximated by the mean of Xt calculated over t∈(rj+1,rj+1).
For type = ``slope'', ft is approximated by the linear spline fit with knots at r1,r2,...,rN minimising the l2 distance between the fit and the data.