WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

UnitRootTest [data]

tests whether data came from an autoregressive time series process with unit root.

UnitRootTest [data,model,"property"]

returns the value of "property" for a given model.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Testing  
Reporting  
Options  
SignificanceLevel  
Applications  
Possible Issues  
Neat Examples  
See Also
Related Guides
History
Cite this Page

UnitRootTest [data]

tests whether data came from an autoregressive time series process with unit root.

UnitRootTest [data,model,"property"]

returns the value of "property" for a given model.

Details and Options

  • UnitRootTest performs a hypothesis test on the time series data with the null hypothesis that the time series satisfying an AR model has a unit root in the denominator of the corresponding transfer function and the alternative hypothesis that it does not.
  • Rejecting the null hypothesis allows the conclusion that the detrended data could have come from a stationary time series.
  • By default, a probability value or -value is returned.
  • A small -value suggests that the presence of a unit root is unlikely.
  • The data can be a list of values {x1,x2,,xn} or a TemporalData object.
  • The model allows the specification of a model , where is the constant offset, is a linear drift, and is the order of the AR model.
  • The following model specifications can be used:
  • Automatic and
    r
    "Constant" and
    "Drift"
    {"Constant",r}
    {"Drift", r} general case
  • UnitRootTest [data] will choose DickeyFuller F test with and .
  • UnitRootTest [data,model,All ] will choose all tests that apply to data and model.
  • UnitRootTest [data,model,"test"] reports the -value according to "test".
  • The following tests can be used:
  • "DickeyFullerF" based on
    "DickeyFullerT" based on
    "PhillipsPerronF" adjusted DickeyFuller F test
    "PhillipsPerronT" adjusted DickeyFuller T test
  • UnitRootTest [data,model,"HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
  • UnitRootTest [data,model,"property"] can be used to directly give the value of "property".
  • Properties related to the reporting of test results include:
  • "AllTests" list of all applicable tests
    "AutomaticTest" test chosen if Automatic is used
    "PValue" list of -values
    "PValueTable" formatted table of -values
    "ShortTestConclusion" a short description of the conclusion of a test
    "TestConclusion" a description of the conclusion of a test
    "TestData" list of pairs of test statistics and -values
    "TestDataTable" formatted table of -values and test statistics
    "TestStatistic" list of test statistics
    "TestStatisticTable" formatted table of test statistics
  • The following option can be used:
  • SignificanceLevel 0.05 cutoff for diagnostics and reporting
  • For unit root tests, a cutoff is chosen such that is rejected only if . The value of used for the "TestConclusion" and "ShortTestConclusion" properties is controlled by the SignificanceLevel option. By default, is set to 0.05.

Examples

open all close all

Basic Examples  (1)

Test whether a time series has a unit root:

Wolfram Language code: data = RandomFunction[ARProcess[{.3}, 1], {1, 50}];
Wolfram Language code: ListLinePlot[data]

The data came from a weakly stationary process:

Wolfram Language code: UnitRootTest[data]

Scope  (17)

Testing  (13)

Test time series data for a unit root:

Wolfram Language code: ur = RandomFunction[ARProcess[{1}, 1, {}], {1, 50}]; nur = RandomFunction[ARProcess[{.1}, 1, {}], {1, 50}];
Wolfram Language code: ListLinePlot[{ur, nur}]

The -values are typically large when a unit root is present:

Wolfram Language code: UnitRootTest[ur]

The -values are typically small when a unit root is not present:

Wolfram Language code: UnitRootTest[nur]

Test for unit root with null hypothesis that the underlying model is ARProcess [2]:

Wolfram Language code: ur = RandomFunction[ARProcess[{.1, 1}, 1, {}], {1, 50}]; nur = RandomFunction[ARProcess[{.1, .2}, 1, {}], {1, 50}];
Wolfram Language code: UnitRootTest[ur, 2]
Wolfram Language code: UnitRootTest[nur, 2]

Setting the model to Automatic is equivalent to assuming an underlying ARProcess [1]:

Wolfram Language code: data = TemporalData[Automatic, {{{0.12080196815318041, -0.06688366570017693, -1.2957111980920009, -2.9774228229447464, -1.936483224346861, 0.2653444024410029, -0.6137847762062091, 0.08488003170612979, 1.8972841613244074, 0.5948279925506049, 1.24 ... 2.605072874506309, -1.8775668149620162, -0.17895918358007856, 0.5015420616914787, -1.728999610172087, -0.28147177421407754, 0.92385660888113, -1.7791121063428887}}, {{2, 50, 1}}, 1, {"Discrete", 1}, {"Discrete", 1}, 1, {}}, False, 9.];
Wolfram Language code: UnitRootTest[data, Automatic]
Wolfram Language code: UnitRootTest[data, 1]

Test for unit root, accounting for an underlying nonzero mean:

Wolfram Language code: ur = TemporalData[TimeSeries, {{{12.669210728975948, 11.147532938592462, 10.36137502036138, 11.294302438388062, 10.144318288340818, 10.78817957063425, 10.113645586607637, 10.781991664579685, 10.751666830954917, 11.367131844577779, 12.827248608 ... 5, 10.81111082113405, 10.798034723293364, 10.019933103498746, 10.02711894026322, 9.180635524588123}}, {{1, 50, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1]; nur = TemporalData[TimeSeries, {{{12.108088025764935, 12.348663110304482, 12.266807499045251, 11.35686449617092, 10.592856666744847, 11.618726232556984, 13.224894851147166, 10.454523657843609, 10.093856790202144, 10.73294791686245, 12.398504969 ... 12.853165158365425, 11.325885303289883, 12.601799259304936, 10.53850213554701, 11.067692295323619}}, {{0, 50, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1];
Wolfram Language code: ListLinePlot[{ur, nur}]
Wolfram Language code: UnitRootTest[ur, "Constant"]
Wolfram Language code: UnitRootTest[nur, "Constant"]

Account for a nonzero mean and assume an underlying ARProcess [3]:

Wolfram Language code: ur = TemporalData[TimeSeries, {{{12.485678723048764, 12.457707590631347, 12.356220089205198, 13.202731103419909, 14.15790117887235, 13.369088747576946, 13.686129901032121, 15.562052318905486, 13.477152743543279, 12.894300687659976, 15.78432979 ... 6, 31.86919424179177, 35.806873269537576, 33.012097684471094, 35.33324159535671, 39.81860874704464}}, {{1, 50, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1]; nur = TemporalData[TimeSeries, {{{12.716950850559492, 11.95044250428509, 10.239561344853092, 11.72656521106882, 12.258204212747586, 13.243847939540128, 11.04167321295747, 12.301901824122686, 10.532506915260647, 11.308588800343228, 10.7900291488 ... 2.761255020828647, 12.274914760360042, 14.145051929943186, 13.231660099434027, 12.581527923796884}}, {{1, 50, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1];
Wolfram Language code: ListLinePlot[{ur, nur}]
Wolfram Language code: UnitRootTest[ur, {"Constant", 3}]
Wolfram Language code: UnitRootTest[nur, {"Constant", 3}]

Assume a nonzero mean and deterministic trend:

Wolfram Language code: ur = TemporalData[TimeSeries, {{{1.2848245440261796, -0.3425454491225972, -2.76974156128997, -4.28152382269845, -3.466734405917938, -4.241951864844546, -6.0495910671581985, -7.540151519354481, -7.904587183717497, -7.479374483717812, -6.4642786 ... , -23.13501856584834, -23.346914266870634, -21.084171068031523, -20.38473263253364, -22.38357597509195}}, {{2, 50, 1}}, 1, {"Discrete", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1]; nur = TemporalData[TimeSeries, {{{0.12080196815318041, -0.06688366570017693, -1.2957111980920009, -2.9774228229447464, -1.936483224346861, 0.2653444024410029, -0.6137847762062091, 0.08488003170612979, 1.8972841613244074, 0.5948279925506049, 1.2 ... 6, 0.5015420616914787, -1.728999610172087, -0.28147177421407754, 0.92385660888113, -1.7791121063428887}}, {{2, 50, 1}}, 1, {"Discrete", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1];
Wolfram Language code: ListLinePlot[{ur, nur}]
Wolfram Language code: UnitRootTest[ur, "Drift"]
Wolfram Language code: UnitRootTest[nur, "Drift"]

Assume a nonzero mean, deterministic trend, and an underlying ARProcess [3]:

Wolfram Language code: ur = TemporalData[TimeSeries, {{{-1.305992036096837, -1.827112945351831, -2.1627097621522844, -4.1622428986699935, -5.416012523749417, -4.412350911989915, -6.1615871731067156, -7.869740942464865, -8.747501968637927, -9.770749112374157, -11.180 ... 47894, 44.95789309221341, 49.564527080634306, 56.2129728017528, 60.89754035165855, 67.39669645439203}}, {{1, 50, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1]; nur = TemporalData[TimeSeries, {{{-0.28569174800540664, 0.06634171992161181, 0.2995498246638215, 1.6598569098953797, 2.1331705273903094, 1.9473913219044103, 1.4839968109419297, 1.3870693896944284, 1.545094711696973, 2.4437273921723395, 1.749162 ... 0507503958111055, -4.4776801587036745, -5.333597555288771, -6.175715534490002, -6.379450169957219}}, {{1, 50, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1];
Wolfram Language code: ListLinePlot[{ur, nur}]
Wolfram Language code: UnitRootTest[ur, {"Drift", 3}]
Wolfram Language code: UnitRootTest[nur, {"Drift", 3}]

Perform a particular test for unit root:

Wolfram Language code: data = TemporalData[TimeSeries, {{{-1.2593135604759231, -1.2337826909137528, -0.7638166378937818, -1.4449728297725644, -1.9674559904020306, -2.8822228243276933, -3.3574235160922132, -0.8140416418708107, 0.6215268695933782, -0.16597774939340448, ... 668776681318445, -15.857838034224033, -15.812986166672088, -16.091212276637293, -15.747099928115142}}, {{1, 100, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1];
Wolfram Language code: UnitRootTest[data, Automatic, "DickeyFullerT"]

Any number of tests can be performed simultaneously:

Wolfram Language code: UnitRootTest[data, Automatic, {"DickeyFullerF", "DickeyFullerT"}]

Using Automatic applies the DickeyFuller F test:

Wolfram Language code: data = TemporalData[TimeSeries, {{{-1.2593135604759231, -1.2337826909137528, -0.7638166378937818, -1.4449728297725644, -1.9674559904020306, -2.8822228243276933, -3.3574235160922132, -0.8140416418708107, 0.6215268695933782, -0.16597774939340448, ... 668776681318445, -15.857838034224033, -15.812986166672088, -16.091212276637293, -15.747099928115142}}, {{1, 100, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1];
Wolfram Language code: UnitRootTest[data, Automatic, Automatic]

The property "AutomaticTest" can be used to determine which test was chosen:

Wolfram Language code: UnitRootTest[data, Automatic, "AutomaticTest"]

Perform all tests appropriate to the data simultaneously:

Wolfram Language code: data = TemporalData[Automatic, {{{-0.4816218166541434, -0.16358165397436036, -0.7377817993238698, -0.42830032446761085, -0.8050227679192111, -1.6764207815550347, -3.168841102281171, -3.5451201343585863, -4.356842637815697, -4.2959833430028045, - ... 57, 12.7723293696119, 12.810533366015934, 11.440254314747376, 13.050176335465256, 12.81022609114599, 11.69008267151061, 11.061560824470149, 12.539224254276276}}, {{1, 100, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {}}, False, 9.];
Wolfram Language code: UnitRootTest[data, Automatic, All]

Use the property "AllTests" to identify which tests were used:

Wolfram Language code: UnitRootTest[data, Automatic, "AllTests"]

Create a HypothesisTestData object for repeated property extraction:

Wolfram Language code: data = TemporalData[Automatic, {{{-0.7402714131343842, -1.9951233123067933, -1.523976721043832, -1.2910834619604106, -0.9373249140527381, 0.07332573183193847, 1.671820974185617, 2.395217958334371, 2.6147472293342484, 2.1237526266493236, 1.670046 ... 307, 11.02809306099669, 12.903224380161044, 14.651432228049682, 14.619485410017823, 15.195180841622236, 14.97128537275672, 15.746556528211672, 15.829432172209756}}, {{1, 100, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {}}, False, 9.];
Wolfram Language code: ℋ = UnitRootTest[data, Automatic, "HypothesisTestData"];

The properties available for extraction:

Wolfram Language code: ℋ["Properties"]

Extract some properties from the HypothesisTestData object:

Wolfram Language code: data = TemporalData[Automatic, {{{1.3393736644750172, 0.21117985738919848, 0.3903496724240176, 1.963771059990626, 3.014004835684255, 4.290457356251644, 4.4653055427847, 4.67004886270268, 5.4883607143737985, 3.5142396668513696, 4.3993670130419344 ... 55187, 12.044839362415239, 10.809871665239243, 8.664439242409841, 9.22431593984081, 7.368217798583508, 6.347313038518147, 6.310434535057582, 6.531051056764879}}, {{1, 100, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {}}, False, 9.];
Wolfram Language code: ℋ = UnitRootTest[data, Automatic, "HypothesisTestData"];

The -value and test statistic from the "DickeyFullerT" test:

Wolfram Language code: ℋ["PValue", "DickeyFullerT"]
Wolfram Language code: ℋ["TestStatistic", "DickeyFullerT"]

Extract any number of properties simultaneously:

Wolfram Language code: data = TemporalData[Automatic, {{{-0.8237147396568484, -0.6968918994777114, -1.8555451255355737, 0.8696496061008259, -0.4465274055570396, 0.6332299821695397, 0.4484054789748259, -0.39867658942896933, -0.8215166837808019, -0.6394252941585873, -1. ... , -3.560911692734363, -3.2433567293653445, -3.7249428490104104, -5.60786219153361, -5.936871579064922, -5.102628105250044, -4.857482036360388, -4.511335147490319}}, {{1, 100, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {}}, False, 9.];
Wolfram Language code: ℋ = UnitRootTest[data, Automatic, "HypothesisTestData"];

The -value and test statistic from a DickeyFuller F test:

Wolfram Language code: ℋ[{"PValue", "DickeyFullerF"}, {"TestStatistic", "DickeyFullerF"}]

Reporting  (4)

Tabulate the results from a selection of tests:

Wolfram Language code: data = TemporalData[Automatic, {{{-1.0478070046374428, -0.2423815332244802, -2.0504136353778026, -0.21740382107897993, -0.9208690650265103, -2.026742935027657, -2.7997550914481533, -3.3436538898130945, -3.8029151219695976, -6.0702838188126, -7.7 ... 497664549511276, -11.000282580085628, -10.520093525498497, -9.753505073507291, -11.577684742186381, -12.198378006290703, -13.164722402230339, -12.742400902262268}}, {{1, 100, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {}}, False, 9.];
Wolfram Language code: ℋ = UnitRootTest[data, 1, "HypothesisTestData"];

A full table of all appropriate test results:

Wolfram Language code: ℋ["TestDataTable", All]

A table of selected test results:

Wolfram Language code: ℋ["TestDataTable", "DickeyFullerF"]

Retrieve the entries from a test table for customized reporting:

Wolfram Language code: data = TemporalData[TimeSeries, {{{-0.7138699376248646, -0.04661937649389336, 0.6284601334264334, -0.4612551845391224, -0.6487660911263642, -1.5231501464086439, -0.9606961402193632, -0.013453384435565097, 1.9775061882189524, 4.422462003662958, 6 ... 745, 4.740835796718794, 6.927584681291996, 8.76987961793021, 11.003943117660214, 14.600138422017785}}, {{1, 100, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1];
Wolfram Language code: ℋ = UnitRootTest[data, 1, "HypothesisTestData"];
Wolfram Language code: res = ℋ["TestData", All];
Wolfram Language code: tests = ℋ["AllTests"]

The -values are above 0.05, so there is not enough evidence to reject at that level:

Wolfram Language code: Show[BarChart[res[[All, 2]], ChartLabels -> Placed[tests, Center], BarOrigin -> Left], Graphics[Line[{{.05, 0}, {.05, Length[tests] + 1}}]]]

Tabulate -values for a test or group of tests:

Wolfram Language code: data = TemporalData[Automatic, {{{0.8767657841087333, 1.1267187532056928, 2.664943663751166, 2.222370295487063, 3.7389235305679596, 2.389099932467536, 2.2084677834755295, 2.4968034560475574, 1.6404416477913975, 0.6963634685415241, 0.460176293059 ... 7311189425643094, -0.65345526665548, -1.0912774152828844, -2.2309547972566013, -1.4509720853847732, -2.0541691803323197, -1.2302813478710632, -0.5159914003216842}}, {{1, 100, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {}}, False, 9.];
Wolfram Language code: ℋ = UnitRootTest[data, 1, "HypothesisTestData"];
Wolfram Language code: ℋ["PValueTable", "DickeyFullerF"]

The -value from the table:

Wolfram Language code: ℋ["PValue", "DickeyFullerF"]

A table of -values from all appropriate tests:

Wolfram Language code: ℋ["PValueTable", All]

A table of -values from a subset of tests:

Wolfram Language code: ℋ["PValueTable", {"DickeyFullerF", "PhillipsPerronF"}]

Report the test statistic from a test or group of tests:

Wolfram Language code: data = TemporalData[TimeSeries, {{{-1.5936910465744076, -3.357349273906714, -3.965028990320997, -4.362056613886581, -4.349200453034948, -3.7079978676383623, -4.785830326726696, -4.690633297205321, -5.820620838560659, -6.2522757649255425, -5.6428 ... 0.77026211545831, -10.88669814649508, -11.562651569377277, -11.827959381986176, -14.565035100006956}}, {{1, 100, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1];
Wolfram Language code: ℋ = UnitRootTest[data, "Drift", "HypothesisTestData"];
Wolfram Language code: ℋ["TestStatisticTable"]

The test statistic from the table:

Wolfram Language code: ℋ["TestStatistic"]

A table of test statistics from all appropriate tests:

Wolfram Language code: ℋ["TestStatisticTable", All]

Options  (1)

SignificanceLevel  (1)

The significance level is used for "TestConclusion" and "ShortTestConclusion":

Wolfram Language code: data = Table[10 i ^ (-.1), {i, 10}];
Wolfram Language code: ℋ1 = UnitRootTest[data, 1, "HypothesisTestData", SignificanceLevel -> .001];
Wolfram Language code: ℋ2 = UnitRootTest[data, 1, "HypothesisTestData", SignificanceLevel -> .005];
Wolfram Language code: ℋ1["TestConclusion", "DickeyFullerT"]//TraditionalForm
Wolfram Language code: ℋ2["TestConclusion", "DickeyFullerT"]//TraditionalForm
Wolfram Language code: ℋ1["ShortTestConclusion", "DickeyFullerT"]
Wolfram Language code: ℋ2["ShortTestConclusion", "DickeyFullerT"]

Applications  (3)

Maximum daily rainfall data for a 47-year period in Sydney, Australia was recorded. Of interest is whether a simple autoregressive model can model this data:

Wolfram Language code: data = ExampleData[{"Statistics", "AustraliaRainfall"}];

The data obviously has nonzero mean:

Wolfram Language code: ListLinePlot[data, Filling -> Axis]

Choose the order of the underlying ARProcess using Schwert's rule of thumb:

Wolfram Language code: pmax[n_] := IntegerPart[12((n/100))^1 / 4]
Wolfram Language code: i = pmax[Length[data]]; While[Abs[UnitRootTest[data, {"Constant", i}, {"TestStatistic", "DickeyFullerT"}]] < 1.6, i-- ]; i

There is evidence of a unit root, suggesting a simple ARProcess is not an adequate model:

Wolfram Language code: UnitRootTest[data, {"Constant", i}, "DickeyFullerT"]

Consider the annual revenue (in millions) by commercial airlines in the United States from 1937 to 1960:

Wolfram Language code: revenue = ExampleData[{"Statistics", "AirlinePassengerMiles"}, "TimeSeries"];
Wolfram Language code: p1 = ListStepPlot[revenue, Filling -> Axis]

The trend is confirmed using UnitRootTest :

Wolfram Language code: UnitRootTest[revenue, "Drift"]

Removing the linear trend appears to be sufficient:

Wolfram Language code: UnitRootTest[Differences[revenue["PathStates"], 1]]

Fit an ARIMAProcess to the time series:

Wolfram Language code: eproc = EstimatedProcess[revenue, ARIMAProcess[2, 1, 2]]

Forecast revenue 10 years ahead using the fitted model:

Wolfram Language code: forecast = TimeSeriesForecast[eproc, revenue, {10}]
Wolfram Language code: ListStepPlot[{revenue, forecast}, Filling -> Axis]

Forecast index SP500:

Wolfram Language code: sp500 = TemporalData[TimeSeries, {{{1459.37, 1466.47, 1461.89, 1457.15, 1461.02, 1472.12, 1472.05, 1470.68, 1472.34, 1472.63, 1480.94, 1485.98, 1492.56, 1494.81, 1494.82, 1502.96, 1500.18, 1507.84, 1501.96, 1498.11, 1513.17, 1495.71, 1511.29, 151 ... {TemporalData`DateSpecification[{2013, 1, 3}, {2013, 12, 2}, "BusinessDay", "DayRange"]}, 1, {"Discrete", 1}, {"Discrete", 1}, 1, {MetaInformation -> {"Source" -> Defer[FinancialData["SP500", {{2013, 1, 3}, {2013, 12, 1}}]]}}}, True, 10.];
Wolfram Language code: sp500["Source"]
Wolfram Language code: DateListPlot[sp500, Filling -> Axis]

Use a unit root test to determine trend presence:

Wolfram Language code: UnitRootTest[sp500, 2, "ShortTestConclusion"]

Fit an ARIMA with nonzero integration order:

Wolfram Language code: eproc = EstimatedProcess[sp500, ARIMAProcess[2, 1, 1]]

Find the forecast for the next month:

Wolfram Language code: forecast = TimeSeriesForecast[eproc, sp500, {26}];
Wolfram Language code: DateListPlot[{sp500, forecast}, Filling -> Axis]

Possible Issues  (2)

The PhillipsPerron tests are limited to ARProcess [1] models:

Wolfram Language code: data = RandomFunction[ARProcess[{.1, .2, .3}, 1], {0, 25}];
Wolfram Language code: UnitRootTest[data, 2, "PhillipsPerronF"]

Use DickeyFuller type tests to test higher orders:

Wolfram Language code: UnitRootTest[data, 2, "DickeyFullerF"]

UnitRootTest fails for irregularly sampled data:

Wolfram Language code: sp500 = ExampleData[{"Statistics", "SP500"}, "TimeSeries"]
Wolfram Language code: RegularlySampledQ[sp500]
Wolfram Language code: UnitRootTest[sp500]

Use values only:

Wolfram Language code: UnitRootTest[sp500["Values"]]

Or set TemporalRegularity to be true:

Wolfram Language code: UnitRootTest[TimeSeries[sp500, TemporalRegularity -> True]]

Neat Examples  (2)

Simulate an approximation to the DickeyFuller T distribution for sample sizes of 100:

Wolfram Language code: data = Table[RandomFunction[ARProcess[{1}, 1, {}], {0, 100}], {10000}];
Wolfram Language code: dfdata = Table[UnitRootTest[i, 1, {"TestStatistic", "DickeyFullerT"}], {i, data}];
Wolfram Language code: Histogram[dfdata]

The test statistic and -value for the first simulated dataset:

Wolfram Language code: {t, p} = UnitRootTest[First[data], 1, {"TestData", "DickeyFullerT"}]

Using the simulated distribution gives a similar result:

Wolfram Language code: Probability[x ≤ t, xdfdata]//N

The approximate distributions of some test statistics under null hypothesis:

Wolfram Language code: data = Table[RandomFunction[ARProcess[{1}, 1, {}], {0, 100}], {1000}];
Wolfram Language code: ℋ = Map[UnitRootTest[#1, 1, "HypothesisTestData"]&, data];
Wolfram Language code: T = Transpose@Table[h["TestStatistic", i], {h, ℋ}, {i, tests = {"DickeyFullerF", "DickeyFullerT", "PhillipsPerronF", "PhillipsPerronT"}}];
Wolfram Language code: Table[SmoothHistogram[T[[i]], PlotRange -> All, PlotLabel -> tests[[i]], Filling -> Axis, ImageSize -> 200], {i, 4}]
Wolfram Research (2012), UnitRootTest, Wolfram Language function, https://reference.wolfram.com/language/ref/UnitRootTest.html.

Text

Wolfram Research (2012), UnitRootTest, Wolfram Language function, https://reference.wolfram.com/language/ref/UnitRootTest.html.

CMS

Wolfram Language. 2012. "UnitRootTest." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/UnitRootTest.html.

APA

Wolfram Language. (2012). UnitRootTest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/UnitRootTest.html

BibTeX

@misc{reference.wolfram_2026_unitroottest, author="Wolfram Research", title="{UnitRootTest}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/UnitRootTest.html}", note=[Accessed: 13-August-2026]}

BibLaTeX

@online{reference.wolfram_2026_unitroottest, organization={Wolfram Research}, title={UnitRootTest}, year={2012}, url={https://reference.wolfram.com/language/ref/UnitRootTest.html}, note=[Accessed: 13-August-2026]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /