ITIME_POINTS — Vector of length NOBSW containing the reference time points t1, …, tNOBSW at which the time series was observed. (Input) The reference time points must be of data type integer and in strictly increasing order. Reference time points for missing values must lie in the open interval (t1, tNOBSW) It is assumed that the time series, after estimation of missing values, contains values at equidistant time points where the distance between two consecutive time points is one.
W — Vector of length NOBSW containing the time series values. (Input) The values must be ordered in accordance with the values in vector ITIME_POINTS. It is assumed that the time series, after estimation of missing values, contains values at equidistant time points where the distance between two consecutive time points is one. If the non‑missing time series values are observed at time points t1, …, tNOBSW, then missing values between ti and ti+1, i = 1, …, NOBSW‑ 1, exist if ti+1‑ti > 1. The size of the gap between ti and ti+1 is then ti+1‑ti‑ 1. The total length of the time series with non‑missing and estimated missing values is tNOBSW‑ti + 1, or ITIME_POINTS(NOBSW)‑ITIME_POINTS(1) + 1.
For example, a time series with six observations with the fourth observation missing would appear as follows:
ITIME_POINTS
W
t1 = 1
.0019
t 2 = 2
.0018
t 3 = 3
.0019
t 4 = 5
.0021
t 5 = 6
.0022
t 6 = 7
.002
In this example, NOBSW = 6 and the length of the time series, Z, including missing values is tNOBSW‑ti + 1 = 7.
Z — Allocatable array which on return will contain the time series values together with estimates for the missing values. (Output)
Optional Arguments
NOBSW — Number of observations in time series W. (Input) Default: NOBSW = size(W).
IMETH — Method used for missing value estimation. (Input) Default: IMETH = 3.
IMETH
Method
0
Median.
1
Cubic Spline Interpolation.
2
AR(1) model.
3
AR(p) model.
If IMETH =2 and the first gap begins at t2 or t3, the corresponding time series values are estimated using method Median. If IMETH= 3 is chosen and the first gap starts at t2, then the values of this gap are also estimated by method Median. If the length of the series before a gap, denoted len, is greater than 1 and less than 2⋅MAXLAG, then MAXLAG is reduced to len/2 for the estimate of the missing values within this gap.
MAXLAG — Maximum number of autoregressive parameters, p, in the AR(p) model when IMETH = 3 is chosen. (Input) See AUTO_UNI_AR for further information. Default: MAXLAG = 10.
MAXBC — Maximum length of backcasting in the least‑squares algorithm when IMETH = 2 is chosen. (Input) MAXBC must be greater than or equal to zero. See NSLSE for further information. Default: MAXBC= 0.
TOLBC — Tolerance level used to determine convergence of the backcast algorithm used when IMETH = 2 is chosen. (Input) Backcasting terminates when the absolute value of a backcast is less than TOLBC. Typically, TOLBC is set to a fraction of wstdev where wstdev is an estimate of the standard deviation of the time series. See NSLSE for further information. Default: TOLBC = 0.01 *wstdev.
TOLSS — Tolerance level used to determine convergence of the nonlinear least‑squares algorithm when IMETH = 2 is chosen. (Input) TOLSS represents the minimum relative decrease in the sum of squares between two iterations required to determine convergence. Hence, TOLSS must be greater than zero and less than one. See NSLSE for further information. The default value is: max{10−10, EPS2∕3} for single precision and max{10−20, EPS2∕3} for double precision,
where EPS = AMACH(4) for single precision and EPS = DMACH(4) for double precision. See the documentation for routine AMACH in the Reference Material.
RELERR— Stopping criterion for use in the nonlinear equation solver when IMETH = 2 is chosen. (Input) See NSLSE for further information. Default: RELERR= 100.0 *AMACH(4) for single precision, RELERR= 100.0 *DMACH(4) for double precision. See the documentation for routine AMACH in the Reference Material.
MAXIT — Maximum number of iterations allowed in the nonlinear equation solver when IMETH = 2 is chosen. (Input) See NSLSE for further information. Default: MAXIT= 200.
WMEAN — Estimate of the mean of time series W. (Input) Default: WMEAN = 0.0.
NOBSZ — Number of elements in the time series Z, with estimated missing values, NOBSZ = ITIME_POINTS(NOBSW)–ITIME_POINTS(1)+1. (Output)
ITIME_POINTS_FULL — Vector of length NOBSZ containing the reference time points of the time series Z. (Output)
MISS_INDEX — Vector of length NOBSZ‑NOBSW containing the indices for the missing values in vector ITIME_POINTS_FULL. (Output)
Specific: The specific interface names are S_ESTIMATE_MISSING and D_ESTIMATE_MISSING.
Description
Traditional time series analysis, as described by Box, Jenkins and Reinsel (1994), requires the observations be made at equidistant time points with no missing values. When observations are missing, the problem of determining suitable estimates occurs. Routine ESTIMATE_MISSING offers four methods for estimating missing values from an equidistant time series.
The Median method, IMETH = 0, estimates the missing observations in a gap by the median of the last four time series values before and the first four values after the gap. If enough values are not available before or after the gap then the number is reduced accordingly. This method is very fast and simple, but its use is limited to stationary ergodic series without outliers and level shifts.
The Cubic Spline Interpolation method, IMETH = 1, uses a cubic spline interpolation method to estimate missing values. Here the interpolation is again done over the last four time series values before and the first four values after the gap. The missing values are estimated by the resulting interpolant. This method gives smooth transitions across missing values.
The AR(1) method, IMETH = 2, assumes that the time series before the gap can be well described by an AR(1) process. If the last observation prior to the gap is made at time point tm then it uses the time series values at t1, t1 + 1, …, tm to compute the one‑step‑ahead forecast at origin tm. This value is taken as an estimate for the missing value at time point tm + 1. If the value at tm + 2 is also missing then the values at time points t1, t1 + 1, …, tm + 1 are used to recompute the AR(1) model, estimate the value at tm + 2 and so on. The coefficient φ1 in the AR(1) model is computed internally by the method of least squares from routine NSLSE.
The AR(p) method, IMETH = 3 ,uses an AR(p) model to estimate missing values by a one‑step‑ahead forecast First, routine AUTO_UNI_AR , applied to the time series prior to the missing values, is used to determine the optimum p from the set {0, 1, …, MAXLAG} of possible values and to compute the parameters φ1, …, φp of the resulting AR(p) model. The parameters are estimated by the method of moments. Denoting the mean of the series by μ the one‑step‑ahead forecast at origin , can be computed by the formula
This value is used as an estimate for the missing value. The procedure, starting with AUTO_UNI_AR, is then repeated for every further missing value in the gap.
All four estimation methods treat gaps of missing values in increasing time order.
Example
Consider the AR(1) process
Wt =ɸ1Wt-1 + at, t =1, 2, 3, …
We assume that is a Gaussian white noise process, . Then, and (see Anderson, p. 174).
The time series in this example was artificially generated from an AR(1) process characterized by and . This process is stationary with . An initial value, was used. The sequence was generated by a random number generator.
From the original series, we remove the observations at time points t = 130, t = 140, t = 141, t = 160, t = 175, and t = 176. Then, ESTIMATE_MISSING is used to compute estimates for the missing values by all 4 estimation methods available. The estimated values are compared with the actual values.