# Meaning of wavelet and scaling coefficients

What is the meaning of wavelet coefficients and scaling coefficients? E.g. for a sequence I obtained the following wavelet coeffients.

How am I supposed to interpret them? I used wavelets package in R. The sequence concers price time series of 21 days. I used the Haar wavelet.

• The Haar wavelet yields a kind of crude derivative at different scales. Here, there is only 18 coefficients, not enough to be a genuine invertible wavelet transformation. Why are you studying such short data, and why with Haar wavelet? – Laurent Duval Nov 6 '19 at 20:02

Assume an input signal or time series $$S$$ of length $$n=2^{j}$$. The length of $$S$$ must be equal to some power of 2, that is, $$n$$ equal to 8, 16, 32, 64, 128, 256, 512, 1024, etc. To transform a signal into wavelets, at each resolution the signal is convolved using a series of scaling coefficients, $$a_0$$, $$a_1$$, $$a_2$$, $$\ldots$$ representing a low pass filter and a sequence of $$d_0$$, $$d_1$$, $$d_2$$, $$\ldots$$ of a high-pass filter.
Scaling function coefficients, $$\phi$$. At the $$j-1$$th resolution, the convolution is taken over the signal's original length, $$2^j$$, in the form $$$$\phi_k = a_{-1}s_{2k+1} + a_0 s_{2k},$$$$ where $$k=0,1,2,\ldots,2^{j-1}-1$$ are the indices of each scaling function, $$s_0, s_1, \ldots, s_{2^{j}-1}$$ are the original input signal elements, and $$a_{-1}$$ and $$a_0$$ are constants from the Haar scaling function. An example of expanding the notation for the $$j-1$$ resolution is $$$$\begin{split} \phi_0 &= a_{-1}s_1 + a_0 s_0\\ \phi_1 &= a_{-1}s_3 + a_0 s_2\\ \vdots\\ \phi_{2^{j-1}-1} &= a_{-1}s_{(2^j-1)} + a_0 s_{(2^j-2)}.\\ \end{split}$$$$ Consider a signal $$S$$ of length $$n=1024=2^{10}$$ $$(j=10)$$, and assume Haar scaling function values of $$a_{-1}=a_0=0.5$$. Although the length of $$S$$ is 1024, the notation used to represent the series of values is $$s_0$$, $$s_1$$, $$s_2$$, $$\ldots$$, $$s_{1023}$$. The first convolution of $$S$$ will result in 512 ($$2^{10-1}=2^9$$) scaling function coefficients, which are obtained using the relationship $$$$\phi_k = 0.5 s_{2k+1} + 0.5 s_{2k}$$$$ where $$k=1,2,\ldots,511$$. This translates to $$$$\begin{split} \phi_0 &= 0.5 s_{1} + 0.5 s_{0}\\ \phi_1 &= 0.5 s_{3} + 0.5 s_{2}\\ \vdots\\ \phi_{511} &= 0.5 s_{1023} + 0.5 s_{1022}\\ \end{split}$$$$ It is easily noticed that the scaling function coefficients are the average of each neighboring pair of signal elements.
Wavelet coefficients, $$\psi$$. The wavelet coefficient is essentially based on the difference between each neighboring pair of signal elements. At the $$j-1$$ resolution, these are $$$$\begin{split} \psi_0 &= -d_{-1}s_1 + d_0 s_0\\ \psi_1 &= -d_{-1}s_3 + d_0 s_2\\ \vdots\\ \psi_{2^{j-1}-1} &= -d_{-1}s_{(2^{j-1}-1)} + d_0 s_{(2^{j-1}-2)}\\ \end{split}$$$$ where $$d_{-1}$$ and $$d_0$$ are both 0.5 based on the Haar wavelet.
For our first convolution of signal $$S$$ of length 1024 at resolution $$j-1$$, the 512 wavelet coefficients are $$$$\begin{split} \psi_0 &= -0.5 s_{1} + 0.5 s_{0}\\ \psi_1 &= -0.5 s_{3} + 0.5 s_{2}\\ \vdots\\ \psi_{511} &= -0.5 s_{1023} + 0.5 s_{1022}\\ \end{split}$$$$