| Wavelet Toolbox | ![]() |
Syntax
[PTS_OPT,KOPT,T_EST] = wvarchg(Y,K,D) [PTS_OPT,KOPT,T_EST] = wvarchg(Y,K) [PTS_OPT,KOPT,T_EST] = wvarchg(Y)
Description
[PTS_OPT,KOPT,T_EST] = wvarchg(Y,K,D)computes the estimated change points of the variance of signal Y for j change points, with j = 1, 2, ... , K-1. Integer KOPT is the proposed number of change points (0
KOPT < K-1). The vector PTS_OPT contains the corresponding change points. If KOPT = 0, PTS_OPT = [].
Integer D is the minimum delay between two change points.
K and D must be integers such that 1 < K << length(Y) and 1
D << length(Y).
The signal Y should be zero mean.
For 2
i
K, T_EST(i,1:i-1) contains the i-1 instants of the variance change points and if KOPT > 0, then PTS_OPT = T_EST(KOPT+1,1:KOPT).
wvarchg(Y,K) is equivalent to wvarchg(Y,K,10).
wvarchg(Y) is equivalent to wvarchg(Y,6,10).
Examples
% Generate signal from a fixed design regression model
% with two change points in the noise variance located
% at positions 200 and 600.
% Generate block test function.
x = wnoise(1,10);
% Generate noisy blocks with change points.
init = 2055615866; randn('seed',init);
bb = randn(1,length(x));
cp1 = 200; cp2 = 600;
x = x + [bb(1:cp1),bb(cp1+1:cp2)/3,bb(cp2+1:end)];
% The aim of this example is to recover the two
% change points in signal x.
% In addition, this example illustrates how the GUI
% tools propose change point locations for interval
% dependent de-noising thresholds.
% 1. Recover a noisy signal by suppressing an
% approximation.
% Perform a single-level wavelet decomposition
% of the signal using db3.
wname = 'db3'; lev = 1;
[c,l] = wavedec(x,lev,wname);
% Reconstruct detail at level 1.
det = wrcoef('d',c,l,wname,1);
% 2. Replace 2% of the biggest values by the mean
% in order to remove almost all the signal.
x = sort(abs(det));
v2p100 = x(fix(length(x)*0.98));
ind = find(abs(det)>v2p100);
det(ind) = mean(det);
% 3. Use wvarchg for estimating the change points with
% the following default parameters.
% - the minimum delay between two change points d = 10.
% - the maximum number of change points is 5.
[pts_Opt,kopt,t_est] = wvarchg(det)
pts_Opt =
199 601
kopt =
2
t_est =
1024 0 0 0 0 0
601 1024 0 0 0 0
199 601 1024 0 0 0
199 261 601 1024 0 0
207 235 261 601 1024 0
207 235 261 393 601 1024
% Estimated change points are close to the true change
% points [200,600].
% 4. (Optional) Replace the estimated change points.
% For 2 <= i <= 6, t_est(i,1:i-1) contains the i-1 instants
% of the variance change points and since kopt is the proposed
% number of change points, then:
% cp_est = t_est(kopt+1,1:kopt);
% You can replace the estimated change points by:
% cp_New = t_est(knew+1,1:knew);
% where 2
knew
6
References
Lavielle, M. (1999), "Detection of multiple changes in a sequence of dependent variables," Stoch. Proc. and their Applications, 83, 2, pp. 79-102.
| wtreemgr | GUI Reference | ![]() |