##SORU
library(WDI)
df = WDI(indicator=c(un='SL.UEM.TOTL.ZS', enf='FP.CPI.TOTL.ZG' ), country=c('TR'), start=1992, end=2020)
library(dynlm)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
df.ts <- ts(df, start=c(1992), end=c(2020),frequency=1)
head(df.ts)
## iso2c country year un enf
## [1,] 1 1 1992 8.51 70.07610
## [2,] 1 1 1993 8.96 66.09384
## [3,] 1 1 1994 8.58 105.21499
## [4,] 1 1 1995 7.64 89.11332
## [5,] 1 1 1996 6.63 80.41215
## [6,] 1 1 1997 6.84 85.66936
plot(df.ts[,"un"], ylab="iÅŸsizlik")
acf(df.ts[,"un"])
acf(df.ts[,"enf"])
enflasyon <- df.ts[,"enf"]
deltaissizlik <- diff(df.ts[,"un"])
plot(enflasyon)
plot(deltaissizlik)
phillips.reg <- dynlm(enflasyon~deltaissizlik)
summary(phillips.reg)
##
## Time series regression with "ts" data:
## Start = 1993, End = 2020
##
## Call:
## dynlm(formula = enflasyon ~ deltaissizlik)
##
## Residuals:
## Min 1Q Median 3Q Max
## -30.44 -24.05 -20.79 27.40 71.41
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 33.002 6.331 5.213 1.92e-05 ***
## deltaissizlik -2.103 5.163 -0.407 0.687
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 33.2 on 26 degrees of freedom
## Multiple R-squared: 0.00634, Adjusted R-squared: -0.03188
## F-statistic: 0.1659 on 1 and 26 DF, p-value: 0.6871
uhat <- resid(phillips.reg)
plot(uhat)
acf(uhat)
library(lmtest)
bgtest(phillips.reg, order=1, type="F")
##
## Breusch-Godfrey test for serial correlation of order up to 1
##
## data: phillips.reg
## LM test = 131.8, df1 = 1, df2 = 25, p-value = 1.844e-11