RESAMPLE - Time Series Resampling

Calculates and returns the (up/down) resampled time series.



RESAMPLE(X, Stock, Sampling, method)

X is the univariate time series data (a one dimensional array of cells (e.g. rows or columns)).

Stock is the univariate time series data corresponds to a Stock or flow type of variable.

Sampling is the new relative sampling rate; 1.0 = input date sampling rate, > 1.0 = Up-Sampling, < 1.0 = Down-Sampling.

method is the imputation method for finding intermediate observations values (0=None, 1=Forward Flat, 2=Backward Flat, 3=Linear, 4=Cubic Spline, 5=FFT, etc.).

Value Method
0 None
1 Forward Flat
2 Backward Flat
3 Linear (default)
4 Cubic Spline
5 Fast Fourier Transform


  1. The time series is homogeneous or equally spaced.
  2. The time series does not include any missing value or spaces.
  3. Economics, business, accounting, and related fields often distinguish between quantities that are stocks and those that are flows. These differ in their units of measurement:
    • A stock variable is measured at one specific time, and represents a quantity existing at that point in time (e.g. price, inventory, capital, liabilities, assets, etc.), which may have accumulated in the past.
    • A flow variable is measured over an interval of time. Therefore a flow would be measured per unit of time (say a month) (e.g. sales, profit, income, investment, etc.).
  4. The imputation method is only needed if the relative sampling value creates an new observation. This is often the case with Up-sampling ( value > 1), or obscure down-sampling (e.g. 0.333, etc.)
  5. For time series of flow-type, the function converts (i.e. integrates) the input time series to a stock-type, resampls it, and, finally, converts (i.e. differences) the resultant (new) time series to a flow-type.
  6. The value of the first observation in the output time series is either estimated for up-sampling cases, or ommitted (i.e. misisng value) for down-sampling cases.
  7. The time index of resampled time series is defined as follow:
    $$ t^* = i \times f_r$$
    • $0 \leq i \lt N^* $
    • $t^*$ : is the time index of the new (resampled) time series.
    • $N^*$ : is the new size of the resampled time series
    • $f_r$ : is the relative sampling frequency
  8. The size of the returned array depends on the size as the input time series and the desired sampling rate.
    $$ N^* = \lfloor (N-1) \times f_r +1 \rfloor$$
    • $N$ : is the size of the input (original) time series
    • $N^*$ : is the new size of the resampled time series
    • $\lfloor.\rfloor$ : is the floor operator or function
    • $f_r$ : is the relative sampling frequency
  9. The RESAMPLE function is available starting with version 1.64 TURRET.

Files Examples


Have more questions? Submit a request