IMSLS_ORDERS, intorders[] (Input) Array of length n_differences containing the order of each difference given in periods. The elements of orders must be greater than or equal to 0.
IMSLS_LOST, int*n_lost (Output) Number of observations lost because of differencing the time series z.
IMSLS_EXCLUDE_FIRST (Input)
or
IMSLS_SET_FIRST_TO_NAN (Input) If IMSLS_EXCLUDE_FIRST is specified, the first n_lost are excluded from w due to differencing. The differenced series w is of length n_observations-n_lost. If IMSLS_SET_FIRST_TO_NAN is specified, the first n_lost observations are set to NaN (Not a Number). This is the default if neither IMSLS_EXCLUDE_FIRST nor IMSLS_SET_FIRST_TO_NAN is specified.
IMSLS_RETURN_USER, floatw[] (Output) If specified, w contains the differenced series. If IMSLS_EXCLUDE_FIRST also is specified, w is of length n_observations. If IMSLS_SET_FIRST_TO_NAN is specified or neither IMSLS_EXCLUDE_FIRST nor IMSLS_SET_FIRST_TO_NAN is specified, w is of length n_observations-n_lost.
Description
Function imsls_f_difference performs m = n_differences successive backward differences of period si = periods [i- 1] and order di = orders [i- 1] for i = 1, ..., m on the n = n_observations observations {Zt} for t = 1, 2, ..., n.
Consider the backward shift operator B given by
for all k. Then, the backward difference operator with period s is defined by the following:
Note that and are defined only for t = (s + 1), ..., n. Repeated differencing with period s is simply
where d≥ 0 is the order of differencing. Note that
is defined only for t = (sd + 1), ..., n.
The general difference formula used in the function imsls_f_difference is given by
where nL represents the number of observations “lost” because of differencing and NaN represents the missing value code. See the functions imsls_f_machine and imsls_d_machineto retrieve missing values. Note that
A homogeneous, stationary time series can be arrived at by appropriately differencing a homogeneous, nonstationary time series (Box and Jenkins 1976, p. 85). Preliminary application of an appropriate transformation followed by differencing of a series can enable model identification and parameter estimation in the class of homogeneous stationary autoregressive moving average models.
Examples
Example 1
Consider the Airline Data (Box and Jenkins 1976, p. 531) consisting of the monthly total number of international airline passengers from January 1949 through December 1960. Function imsls_f_difference is used to compute
The data for this example is the same as that for the initial example. The first n_lost observations are excluded from W due to differencing, and n_lost is also output.
#include <imsls.h>
#include <stdio.h>
int main()
{
int i;
int n_observations = 24;
int n_differences = 2;
int periods[2] = {1, 12};
int n_lost;
float *z;
float *difference;
/* Get airline data */
z = imsls_f_data_sets (4,
0);
/* Compute differenced time series when observations