Next: copyright Up: MacAnova Help File Previous: contrast()   Contents

convolve()

Usage:
convolve(wts, x [, reverse:T, decimate:M]), wts a REAL vector, x a REAL
  vector or matrix, M a positive integer



Keywords: time series
convolve(a,x) performs a circular convolution of the values in vector a
with each of the columns of vector or matrix x.  If we index rows
starting with 0, so that a contains elements a[0], a[1], ..., a[p-1],
and a column of x contains x[0], x[1], ..., x[n-1], the corresponding
column of the result is computed as follows:

  d[k] = sum(a[j]*x[k-j],j=0,min(k,p-1)) + sum(a[j]*x[k-j+n],j=k+1,p-1),

where the second sum is omitted when k >= p - 1.

convolve(a,x,reverse:T) computes sums of circularly lagged products of
the elements of a and each column of x.  Explicitly, with the same
indexing,

 d[k] = sum(a[j]*x[j-k+n],j=0,min(k-1,p-1)) + sum(a[j]*x[j-k],j=k,p-1)

where the first sum is omitted when k = 0 and the second sum is
omitted when k >= p.

convolve(a,x,decimate:M) and convolve(a,x,reverse:T,decimate:M) "thin"
the result by a factor of about 1/M.  M must be a positive integer.

Specifically, if d is the result of an unthinned convolution, the value
returned is a K by ncols(x) matrix where K = floor((nrows(x)-1)/M) + 1
with d[1 + (j-1)*M,] in row j.  This option is useful if a is the
impulse response function of a smoothing filter.

See also autoreg(), movavg().


Gary Oehlert 2003-01-15