Skip to main content
v2026.11,858 entries · CC-BY 4.0

Dickey-Fuller Test in Stata: dfuller Syntax and Output

Run the Dickey-Fuller test in Stata with dfuller: syntax, the four noconstant/drift/trend cases, and how to read Z(t), critical values and the p-value.

Written and maintained by CASRAI Editorial Board

Last updated

The Dickey-Fuller test in Stata is run with the dfuller command, which performs the augmented Dickey-Fuller (ADF) unit-root test on a single time series. The null hypothesis is that the variable contains a unit root; the alternative is that it was generated by a stationary process. Before you type it, three decisions matter more than the syntax: that the data are tsset, which of four deterministic-term cases fits the series, and how many lagged differences to include. This guide covers all three, then shows how to read the printed output using the two worked examples in Stata’s own manual (one that rejects the unit root, one that does not).

What the Dickey-Fuller test is used for in research

A unit-root test asks whether a series behaves like a random walk, so that shocks to it never die out, or like a stationary process that returns to a stable mean or trend. Researchers run it before fitting models that assume stationarity, such as the ARIMA models described in ARIMA models for research time series, or before testing predictive relationships as in Granger causality. For the wider methods context, see what is econometrics.

Stata’s dfuller implements the augmented version of the test: it adds k lagged difference terms to the regression to absorb serial correlation. Setting lags(0) corresponds to the regression with k = 0, the plain Dickey-Fuller regression. The test comes from Dickey and Fuller (1979), Journal of the American Statistical Association 74: 427-431.

Install or access (official source only)

dfuller is an official command in Stata’s time-series suite; there is nothing to install separately. It is documented in the Stata Time Series Reference Manual under [TS] dfuller (this guide follows the Release 19 manual). You can reach it from the menus:

Statistics > Time series > Tests > Augmented Dickey-Fuller unit-root test

Inside Stata, help dfuller opens the same documentation for the release you are running; if your release differs from Release 19, check that help file for any differences in options or output.

Step-by-step: running dfuller

  1. Declare the time variable. The manual states: “You must tsset your data before using dfuller.” For example, tsset qtr for a quarterly date variable. The variable you test may contain time-series operators.
  2. Look at the series. The manual says that deciding which case to use “involves a combination of theory and visual inspection of the data.” Plot it with tsline or the Graphics menu before choosing options.
  3. Choose the deterministic terms (next section) and the number of lagged differences.
  4. Run the command: dfuller varname [if] [in] [, noconstant trend drift regress lags(#)]. A typical call is dfuller ln_consump, lags(4) trend.
  5. Read the result against the critical values and the MacKinnon p-value, as explained below.

The same workflow belongs in a do-file so the test is reproducible; see Stata do-files: structure and reproducible workflow.

Choosing noconstant, drift or trend

The options select which of four cases the test uses. Per the manual, noconstant cannot be combined with trend or drift, and trend cannot be combined with noconstant or drift.

Case Null hypothesis Restriction on the regression Stata option
1 Random walk without drift Constant (α) = 0 and trend coefficient (δ) = 0 noconstant
2 Random walk without drift Trend coefficient (δ) = 0; constant estimated none (the default)
3 Random walk with drift Trend coefficient (δ) = 0 drift
4 Random walk with or without drift No restriction trend

The manual’s practical guidance: if the graph shows an upward trend, use case four (trend); if there is no trend but the mean is nonzero, use case two (the default).

One consequence worth knowing: except in case three, the test statistic does not follow a standard t distribution. dfuller interpolates critical values from Fuller (1996) tables and reports MacKinnon (1994) approximate p-values, so use the critical values Stata prints, not a t table. In case three (drift) the usual t distribution applies. Both use a one-sided alternative (β below zero).

Choosing lags(#)

lags(#) sets the number of lagged difference terms. The [TS] dfuller manual does not give a rule for picking it, so the choice is the analyst’s to justify and report. Stata’s dfgls command can report lag-length selections (see the alternatives table), and other software, such as Python’s statsmodels, offers automatic selection by information criterion. Whatever you choose, state it alongside the result.

Output and how to read it

Example 1: a series that rejects the unit root

The manual’s first example uses the Stata Press dataset air2:

use https://www.stata-press.com/data/r19/air2
dfuller air, lags(3) trend regress

The output is titled “Augmented Dickey-Fuller test for unit root”, with 140 observations and 3 lags. The test statistic is Z(t) = -6.936 against critical values of -4.027 (1%), -3.445 (5%) and -3.145 (10%), and the MacKinnon approximate p-value is 0.0000. Z(t) is far below every critical value, and the manual concludes that “we can overwhelmingly reject the null hypothesis of a unit root.” The regress option adds the underlying regression table, in which the coefficient on the lagged level (L1.) is -0.5217; the manual notes that this implies ρ = 0.478.

Example 2: a series that does not

The second example uses lutkepohl2, a quarterly series from 1960q1 to 1982q4:

use https://www.stata-press.com/data/r19/lutkepohl2
tsset qtr
dfuller ln_consump, lags(4) trend

With 87 observations, Z(t) = -1.318 against critical values of -4.069 (1%), -3.463 (5%) and -3.158 (10%); the p-value is 0.8834. Z(t) is not more negative than any critical value, so the unit-root null cannot be rejected.

How to read the columns

Part of the output What it tells you
Z(t) The test statistic, β̂ / se(β̂) for the lagged level in the regression. Testing β = 0 is equivalent to testing ρ = 1.
1%, 5%, 10% critical values Reject the unit root at that level when Z(t) is more negative than the value (one-sided alternative, β below zero).
MacKinnon approximate p-value The approximate p-value for Z(t), based on MacKinnon (1994).
Number of obs, Number of lags The sample actually used and the lags(#) you chose. Report both.

Failing to reject is not proof of a unit root; the null is simply not rejected. Stata’s own blog on unit-root tests stresses stating the null and alternative hypotheses clearly, which is good practice in a methods section.

Using the results programmatically

After dfuller, the results are stored in r(): r(N), r(lags), r(Zt), r(cv_1), r(cv_5), r(cv_10), r(level) and the matrix r(table). r(p) is stored only if a constant or trend is in the regression, so it is absent under noconstant. List them with return list and reference them in a do-file so tables update when the data change.

Troubleshooting

  • Stata complains about the time variable. The data must be tsset first. Declare the time variable (and panel variable, if any) before running dfuller.
  • An option combination is rejected. noconstant cannot be combined with trend or drift, and trend cannot be combined with noconstant or drift. Pick one case.
  • No p-value in r(p). It is stored only when the regression includes a constant or trend; you used noconstant.
  • Critical values do not match a textbook t table. That is expected: outside case three the statistic is not t-distributed, and Stata uses Fuller (1996) and MacKinnon (1994) results.
  • You have panel data. dfuller tests one series. The manual lists xtunitroot for panel unit-root tests.
  • Residual autocorrelation concerns. The lagged differences exist to handle serial correlation; to check a fitted regression’s residuals, see the Durbin-Watson test.

Other tests and software

The Stata commands below are the ones the manual and Stata’s blog name alongside dfuller. The last two rows show the same test in other software; note that their defaults differ from Stata’s, so results are not directly comparable unless you align the options.

Tool What it does, per its documentation
Stata pperron Phillips-Perron test: the same regression as the ADF test, with the test statistics adjusted for serial correlation and heteroskedasticity.
Stata dfgls GLS-detrends the series first and includes a linear trend by default (unlike dfuller and pperron); maxlag() sets the upper bound and it reports lag choices by Ng-Perron sequential t, SC and MAIC. Elliott et al. (1996) show the test has better power than the ADF test.
Stata xtunitroot Unit-root tests for panel data.
Python statsmodels adfuller Augmented Dickey-Fuller test; default regression='c' (constant only), autolag='AIC', and maxlag defaults to 12*(nobs/100)^{1/4}. Options 'ct', 'ctt' and 'n' change the deterministic terms.
R tseries adf.test Augmented Dickey-Fuller test using a constant and linear trend; lag order k defaults to trunc((length(x)-1)^(1/3)); with k = 0 it computes the standard Dickey-Fuller test; p-values are interpolated from tables and missing values are not allowed.

FAQ

What is the Stata command for the Dickey-Fuller test?

dfuller, found under Statistics > Time series > Tests > Augmented Dickey-Fuller unit-root test. Declare the time variable with tsset first.

How do I see the regression behind the test?

Add the regress option, for example dfuller air, lags(3) trend regress. By default the regression table is not displayed.

Is dfuller a regression command?

It runs a regression internally (the lagged-level and lagged-difference regression shown by regress), but you call it as a test command. For ordinary regression commands such as regress, see regression in Stata.

Which option should I use: noconstant, drift or trend?

Per the manual, use theory and a plot of the data: an upward trend points to trend; no trend with a nonzero mean points to the default.

Where is the p-value?

The printed “MacKinnon approximate p-value for Z(t)”. It is also in r(p) unless you specified noconstant.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Dickey-Fuller Test in Stata: dfuller Syntax and Output

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Ask CASRAI · Regulatory Radar

Research-admin question? Get an answer that links its sources.

An AI assistant specialized in research administration. Every answer links its sources to check before you act. 2 questions free, no account. $29/month after.

  • Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
  • Every answer numbers its sources and links each one, so you can check the source yourself.