Other Time Series Functions | Extreme Optimization Numerical Libraries for .NET Professional |

In addition to the time series models discussed earlier, several functions and tests specific to time series analysis are available.

The TimeSeriesFunctions defines a number of static methods that perform calculations that are common in time series analysis.

The AutoCovarianceFunction(Vector

If more information is required, the GetAutocorrelationFunctionInfo(Vector

The first argument of this method is the time series for which to evaluate the autocorrelation function.
The remaining arguments are optional. The first optional argument is the lag order.
By default, values for lags up to 40 are included. The second optional argument
specifies whether columns should be included for the lower and upper bounds of
the confidence interval. The default is

Given a vector that contains the auto-correlation function of a time series, the
PartialAutocorrelationFunction(Vector

DurbinWatsonStatistic(Vector

The Augmented Dickey-Fuller (ADF) test is a hypothesis test that tests for the presence of a unit root in a time series. The test is based on a regression analysis of a time series model that may contain a constant term for drift and a trend term. The number of auto-regressive terms in the regression model may be specified, or a reasonable default value can be computed.

The ADF test is implemented by the AugmentedDickeyFullerTest class, which has one constructor that takes up to 3 arguments. The first argument is a vector that contains the time series the test is to be applied to. The second argument specifies the auto-regressive order of the time series model. If it is omitted or negative, then the cube root of the size of the sample, rounded down to the nearest integer, is used. The third argument is a DickeyFullerTestType value that specifies the type of regression model used. The possible values are:

Value | Description |
---|---|

NoConstant | A constant or trend is not included. |

Constant | A constant term (drift) is included. |

ConstantAndTrend | A constant term (drift) and a trend term are both included. |

The default is to include a constant and a trend term.

The critical values for the distribution of the Dickey-Fuller statistic are different depending on whether drift and trend are included. The values are interpolated from table 4.2 in Banerjee et.al.

In this example we look at consumption in Germany between 1960 and 1982. Economic theory suggests that the log of the data may show a unit root.

var data = Extreme.Data.Stata.StataFile.ReadDataFrame("lutkepohl2.dta"); var adf = new AugmentedDickeyFullerTest(data["ln_consump"].As<double>(), 4); Console.WriteLine("Augmented Dickey-Fuller statistic: {0:F3}", adf.Statistic); var dist = adf.Distribution; Console.WriteLine("Critical values:"); Console.WriteLine(" 1% : {0:F3}", dist.InverseDistributionFunction(0.01)); Console.WriteLine(" 5% : {0:F3}", dist.InverseDistributionFunction(0.05)); Console.WriteLine(" 10% : {0:F3}", dist.InverseDistributionFunction(0.10));

The value of the test statistic is -1.318. The critical values at the 1%, 5%, and 10% levels are -4.060, -3.459, and -3.155, so the null hypothesis is not rejected.

A. Banerjee, J. J. Dolado, J. W. Galbraith, and D. F. Hendry (1993):

*Cointegration, Error Correction, and the Econometric Analysis of Non-Stationary Data*, Oxford University Press, Oxford.S. E. Said and D. A. Dickey (1984):

*Testing for Unit Roots in Autoregressive-Moving Average Models of Unknown Order.*Biometrika 71, 599–607

Copyright © 2004-20116,
Extreme Optimization. All rights reserved.

*Extreme Optimization,* *Complexity made simple*, *M#*, and *M
Sharp* are trademarks of ExoAnalytics Inc.

*Microsoft*, *Visual C#, Visual Basic, Visual Studio*, *Visual
Studio.NET*, and the *Optimized for Visual Studio* logo

are
registered trademarks of Microsoft Corporation.