Discrete Convolution Integral

$$ Q_n = \sum^{n \le m}{m=1} P_m \cdot U{n-m+1} $$

lagmatrix

P <- lagmatrix(R) creates a lagged (shifted) version of a vector. The lagmatrix function is useful for creating a regression matrix of explanatory variables for rainfall over time.

Given a vector of time series data, such as daily rainfall: $$ \left[ P_1, P_2, P_3, \cdots , P_m \right]$$ A lagged transform of the time series is found by shifting the first lag, then the second lag, and so on, until the end of the vector. The lagmatrix result will be the following:

$$ \begin{bmatrix} P_1 & 0 & 0 & \cdots & 0 & 0 & \cdots & 0 & 0 \ P_2 & P_1 & 0 & \cdots & 0 & 0 & \cdots & 0 & 0 \ P_3 & P_2 & P_1 & \cdots & 0 & 0 & \cdots & 0 & 0 \ \vdots & &&& \vdots &&& \vdots \ P_m & P_{m-1} & P_{m-2} & \cdots & P_1 & 0 & \cdots & 0 & 0 \ 0 & P_{m} & P_{m-1} & \cdots & P_2 & P_1 & \cdots & 0 & 0 \ \vdots & &&& \vdots &&& \vdots \ 0 & 0 & 0 & \cdots & 0 & 0 & \cdots & P_m & P_{m-1} \ 0 & 0 & 0 & \cdots & 0 & 0 & \cdots & 0 & P_m \ \end{bmatrix} $$



dCraigJones/rSSOAP documentation built on Aug. 12, 2022, 10:11 p.m.