# Terminologies - lags, order in time series model

I am facing some difficulties with the terminologies - lag ($p$) and sequence length (number of data points) (N) used in time series model such as Moving average and Autoregressive model. Considering a Moving Average model described by the equation

$$y(n) = \sum_{i=1}^{p} h(i) x(i-n)$$ If the number of bits in the input is N=16 defined by $\mathbf{x} = \{1,0,1,1,0,1,0,1,1,0,1,1,0,0,1,1\}$ and the number of lags are p=10 then

Q1: should the model generate a time series of length 'N=16 i.e, would the output of the above model $\mathbf{y} = [y_1,y_2,\ldots,y_N]$ contain 16 elements where $n = 1,2,\ldots,16$?

I am writing out the full expression. I can write the MA process in vector form as $y_n = \mathbf{h}^T \mathbf{x}_n$ where $\mathbf{x}_n = [x_n,x_{n-1},\ldots,x_{n-p+1}]^T$ is the input signal vector and $\mathbf{h} = [h_0,h_1,\ldots,h_{p-1}]^T$ is the MA system coefficients. For example, in programming using Matlab the model would look like for

h = [1,0.2,0.3]; %channel coefficients
N=16;%number of data points
x = rand(1,N); %input data vector
p=2;
y(1) =0.0;
y(2) = 0.0;
for n = 3:N
y(n) = h(1)*x(n) +h(2)*x(n-1)+h(3)*x(n-2);
end


Since the order p=2 would the physical interpretation be that the channel can take in only 2 data values as input? Also, does p=2 mean that the channel has 2 paths through which the data input travels?

Q2: Is there a relationship between the number of input elements and the number of lags?

Please correct me if I have misinterpreted the concepts. Thank you.

• $$p \le N {}{}$$ Commented May 11, 2017 at 2:38
• For a filtering operation, you want $x(n-i)$ to describe a discrete convolution. What you have now is a discrete cross-correlation. Either way, if you assume the sequences to be zero padded the complete convolution results in $N+p-1$ output terms. Commented May 11, 2017 at 12:35

Q1: should the model generate a time series of length 'N=16 i.e, would the output of the above model $\mathbf{y} = [y_1,y_2,\ldots,y_N]$ contain 16 elements where $n = 1,2,\ldots,16$?

If one thinks about your question in terms of FIR filtering, then an input signal, $x$ of length $N$ filtered with an FIR filter of length $p$ ($p$ coefficients) will have an output of length $p + N - 1$.

Note: there are ways to define the output so that only $N$ outputs are obtained, but you need to understand that is what you are doing.

Since the order p=2 would the physical interpretation be that the channel can take in only 2 data values as input?

It means the channel does not change the input much at all. It's a two coefficient FIR filter.

Also does p=2 mean that the channel has 2 paths through which the data input travels?

One way to interpret the FIR (MA) nature of the filter you are using is that it involves $p$ paths with a time delay of $nT$ (where $T$ is the sample period).

Q2: Is there a relationship with the number of input elements and the number of lags?

In general, no, there will not be a relationship.

(1) Is this related to "multipath" often used in Rayleigh fading? If there are $p$ paths then would the transmitted signal travel in two directions?

The usual method of modeling multi-path is to say that the receiver receives: $$y^c(t) = \sum_{i=1}^{p} h^c_i x^c(t - d_i)$$ where this is the continuous-time version so the $d_i$ are not integers and $d_1 = 0$.

Moving to the discrete-time version means you need to sample everything using $t = nT$. So if you stick with $p$ components, you can only really have $d_i = (i-1)T$.

(2) What is the general way to set $nT$? Using Matlab, I did not do any thing in my code. Can you say what is $nT$ for my example?

$T$ is determined by your modeling. How did you relate the actual continuous-time problem to the discrete case?

• @SrishtiM See response in my edit.
– Peter K.
Commented May 11, 2017 at 23:17