0% found this document useful (0 votes)
11 views

ps4lab

Uploaded by

anonim anonim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

ps4lab

Uploaded by

anonim anonim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ECON324 Econometrics

Büşra ARAS

2024-05-09

Imagine you are playing a game of catch with a friend. If you throw the ball back and forth at the same
speed and distance, that’s like a stationary time series. But if you keep throwing the ball harder and farther,
that’s like a non-stationary time series.
There are two tests that we can use to see if a time series is stationary or non-stationary. The first test
is called the ADF test, which stands for Augmented Dickey-Fuller test. The second test is called the
Phillips-Perron test.
The ADF test looks at the data points and checks to see if the average value of the data points is the same
over time. If the average value is the same, then the time series is stationary. If the average value is not the
same, then the time series is non-stationary.
The Phillips-Perron test is similar to the ADF test, but it is a bit more advanced. It checks to see if the
data points are changing in a predictable way. If the data points are changing in a predictable way, then
the time series is stationary. If the data points are changing in an unpredictable way, then the time series is
non-stationary.
The difference between ADF and Phillips Perron Test So, in short, The ADF test checks if the mean
of the time series is constant over time and Phillips-Perron test checks if the variance of the time series is
constant over time.
Problem 1-) Use the data in TRAFFIC2. The data consists of monthly data, on traffic accidents in California
over the years 1981 to 1989.
i-) Using the standard Dickey-Fuller regression, test whether ltotacct which is the logarithm of statewide
total accidents has a unit root. Can you reject a unit root at the 2.5% level?
ii) Now, add two lagged changes to the test from part (i) and compute the augmented Dickey- Fuller test.
What do you conclude?
iii) Add a linear time trend to the ADF regression from part (ii). Now what happens?
iv) Apply Phillips Perron test. Which test do you prefer to apply and why?
Solution
(i) H0 : Time series process is non-stationary/has a unit root. So we carry out the DF test since it is not
ADF we include no lagged values of ltotacc, before proceeding to test we describe the data as time
series.
library(urca)
library(wooldridge)
data("traffic2")

# Convert the data to time series


ltotacc <- ts(traffic2$ltotacc, start = c(1981, 1), frequency = 12)

1
# Apply Dickey Fuller test asked in (i) with no lag values of ltotacc included.
summary( ur.df(ltotacc , type = c("drift"), lags = 0) )

##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression drift
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.207551 -0.033614 0.003369 0.039204 0.181055
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.0513 0.6192 3.313 0.00127 **
## z.lag.1 -0.1923 0.0581 -3.310 0.00128 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.06488 on 105 degrees of freedom
## Multiple R-squared: 0.09451, Adjusted R-squared: 0.08589
## F-statistic: 10.96 on 1 and 105 DF, p-value: 0.001277
##
##
## Value of test-statistic is: -3.3105 5.5059
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau2 -3.46 -2.88 -2.57
## phi1 6.52 4.63 3.81
The DF statistic is about -3.310, which is to the left of the 5% critical value (-2.88), and so, using this test,
we can reject a unit root at the 5% level.
# Apply Dickey Fuller test asked in (ii) with 2 lag values of ltotacc included.
summary( ur.df(ltotacc , type = c("drift"), lags = 2))

##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression drift
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + z.diff.lag)
##
## Residuals:

2
## Min 1Q Median 3Q Max
## -0.179842 -0.022030 0.008181 0.036648 0.130033
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.90974 0.60360 1.507 0.13488
## z.lag.1 -0.08503 0.05663 -1.501 0.13636
## z.diff.lag1 -0.47274 0.09956 -4.748 6.78e-06 ***
## z.diff.lag2 -0.28699 0.09372 -3.062 0.00282 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.05802 on 101 degrees of freedom
## Multiple R-squared: 0.2635, Adjusted R-squared: 0.2417
## F-statistic: 12.05 on 3 and 101 DF, p-value: 8.322e-07
##
##
## Value of test-statistic is: -1.5015 1.3178
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau2 -3.46 -2.88 -2.57
## phi1 6.52 4.63 3.81
(ii) When two lagged changes are added to the regression in part (i), the t statistic becomes -1.501. Now,
there is little evidence against a unit root.
# Apply **Augmented Dickey Fuller** test asked in (iii) with choosing lag values of ltotacc with AIC cri
# Run ADF test with drift and linear trend, selecting lag length based on AIC
summary( ur.df(ltotacc , type = c("trend"), lags=2))

##
## ###############################################
## # Augmented Dickey-Fuller Test Unit Root Test #
## ###############################################
##
## Test regression trend
##
##
## Call:
## lm(formula = z.diff ~ z.lag.1 + 1 + tt + z.diff.lag)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.162425 -0.026681 0.004889 0.034606 0.127042
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.4661597 1.2178540 3.667 0.000395 ***
## z.lag.1 -0.4252627 0.1160105 -3.666 0.000397 ***
## tt 0.0012686 0.0003828 3.314 0.001281 **
## z.diff.lag1 -0.2525636 0.1159053 -2.179 0.031676 *
## z.diff.lag2 -0.1724813 0.0958546 -1.799 0.074970 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3
##
## Residual standard error: 0.05535 on 100 degrees of freedom
## Multiple R-squared: 0.3364, Adjusted R-squared: 0.3099
## F-statistic: 12.67 on 4 and 100 DF, p-value: 2.217e-08
##
##
## Value of test-statistic is: -3.6657 4.6264 6.7301
##
## Critical values for test statistics:
## 1pct 5pct 10pct
## tau3 -3.99 -3.43 -3.13
## phi2 6.22 4.75 4.07
## phi3 8.43 6.49 5.47
(iii) If we add a time trend to the regression in part (ii), the ADF statistic becomes -3.666. The 5% critical
value is -3.43, and so we are back to fairly convincingly rejecting a unit root.
The ADF test results depends on the specification so the results are not robust, and in part (iii) we can see
that ltotacc may contain a trend, thus using PP test we can confirm our results. For PP test H0 is same as
ADF, indicating non-stationary/has a unit root.
PP.test(ltotacc)

##
## Phillips-Perron Unit Root Test
##
## data: ltotacc
## Dickey-Fuller = -7.0448, Truncation lag parameter = 4, p-value = 0.01
The reported test statistic (Dickey-Fuller=-7.0448) is the Phillips-Perron test statistic. This statistic measures
the strength of evidence against the null hypothesis of a unit root (non-stationarity) in the time series
(ltotacc). The p value for the PP test less than 0.05 indicating that we reject the null hypothesis of a unit root.
Therefore, the test results suggest that the ltotacc time series is likely stationary based on the Phillips-Perron
test.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy