For a given time series which is n timestamps in length, we can take Discrete Wavelet Transform (using 'Haar' wavelets), then we get (for an example, in Python) -
>>> import pywt >>> ts = [2, 56, 3, 22, 3, 4, 56, 7, 8, 9, 44, 23, 1, 4, 6, 2] >>> (ca, cd) = pywt.dwt(ts,'haar') >>> ca array([ 41.01219331, 17.67766953, 4.94974747, 44.54772721, 12.02081528, 47.37615434, 3.53553391, 5.65685425]) >>> cd array([-38.18376618, -13.43502884, -0.70710678, 34.64823228, -0.70710678, 14.8492424 , -2.12132034, 2.82842712])
where ca and cd are approximation and detailed coefficients. Now if I use all of them I can construct my original time series back using inverse DWT. But instead I want to use a fewer coefficients (like in Fourier Transform if we use only first few coefficients, we can approximately reconstruct the original time series). If I just use
ca or just use
cd I don't get the desired results. If I use only we coefficients from each of them (like first 4), I get only half of the time series.
How should I select the coefficients (from
cd) so that I can approximately create the original signal from them (i.e. most of its energy)?