To extract the p-value from an ADF (Augmented Dickey-Fuller) test in R, you can use the adf.test()
function from the tseries
package or the ur.df()
function from the urca
package. Both functions provide the p-value as part of their output.
Here's an example of how to use the adf.test()
function:
main.r179 chars12 lines
And here's an example with the ur.df()
function:
main.r200 chars12 lines
Make sure to replace your_data
with your actual data.
The p-value represents the probability of observing a test statistic as extreme as the one calculated from the sample data if the null hypothesis (usually the presence of a unit root) is true. Smaller p-values indicate stronger evidence against the null hypothesis.
gistlibby LogSnag