Table of Contents
The Augmented Dickey-Fuller Test is a statistical method used for testing the presence of a unit root in a time series data, which indicates non-stationarity. This test is commonly used in econometric analysis to determine the presence of a trend or seasonality in a dataset.
To conduct an Augmented Dickey-Fuller Test in R, the following steps can be followed:
1. Load the dataset into R and make sure it is in a time series format.
2. Install and load the “tseries” package, which contains the adf.test function for performing the test.
3. Use the adf.test function with the time series data as the input.
4. The output of the test will include the test statistic, the p-value, and the critical values at different significance levels.
5. Based on the p-value, the null hypothesis of a unit root can be accepted or rejected. A p-value less than the chosen significance level (usually 0.05) indicates the presence of a unit root and non-stationarity in the data.
An example of the application of the Augmented Dickey-Fuller Test would be to determine the stationarity of a stock price time series data. The test can be used to check if the stock prices follow a random walk or if there is a trend present. This information can be useful for making investment decisions.
Augmented Dickey-Fuller Test in R (With Example)
A time series is said to be “stationary” if it has no trend, exhibits constant variance over time, and has a constant autocorrelation structure over time.
One way to test whether a time series is stationary is to perform an augmented Dickey-Fuller test, which uses the following null and alternative hypotheses:
H0: The time series is non-stationary. In other words, it has some time-dependent structure and does not have constant variance over time.
HA: The time series is stationary.
If the from the test is less than some significance level (e.g. α = .05), then we can reject the null hypothesis and conclude that the time series is stationary.
The following step-by-step example shows how to perform an augmented Dickey-Fuller test in R for a given time series.
Example: Augmented Dickey-Fuller Test in R
Suppose we have the following time series data in R:
data <- c(3, 4, 4, 5, 6, 7, 6, 6, 7, 8, 9, 12, 10)
Before we perform an augmented Dickey-Fuller test on the data, we can create a quick plot to visualize the data:
plot(data, type='l')

To perform an augmented Dickey-Fuller test, we can use the function from the tseries library.
The following code shows how to use this function:
library(tseries) #perform augmented Dickey-Fuller test adf.test(data) Augmented Dickey-Fuller Test data: data Dickey-Fuller = -2.2048, Lag order = 2, p-value = 0.4943 alternative hypothesis: stationary
Here’s how to interpret the most important values in the output:
- Test statistic: -2.2048
- P-value: 0.4943
This means the time series is non-stationary. In other words, it has some time-dependent structure and does not have constant variance over time.
Cite this article
stats writer (2024). What is the procedure for conducting an Augmented Dickey-Fuller Test in R, and can you provide an example of its application?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/what-is-the-procedure-for-conducting-an-augmented-dickey-fuller-test-in-r-and-can-you-provide-an-example-of-its-application/
stats writer. "What is the procedure for conducting an Augmented Dickey-Fuller Test in R, and can you provide an example of its application?." PSYCHOLOGICAL SCALES, 30 Apr. 2024, https://scales.arabpsychology.com/stats/what-is-the-procedure-for-conducting-an-augmented-dickey-fuller-test-in-r-and-can-you-provide-an-example-of-its-application/.
stats writer. "What is the procedure for conducting an Augmented Dickey-Fuller Test in R, and can you provide an example of its application?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/what-is-the-procedure-for-conducting-an-augmented-dickey-fuller-test-in-r-and-can-you-provide-an-example-of-its-application/.
stats writer (2024) 'What is the procedure for conducting an Augmented Dickey-Fuller Test in R, and can you provide an example of its application?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/what-is-the-procedure-for-conducting-an-augmented-dickey-fuller-test-in-r-and-can-you-provide-an-example-of-its-application/.
[1] stats writer, "What is the procedure for conducting an Augmented Dickey-Fuller Test in R, and can you provide an example of its application?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, April, 2024.
stats writer. What is the procedure for conducting an Augmented Dickey-Fuller Test in R, and can you provide an example of its application?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
