R Markdown
library(pdfetch)
data1<-pdfetch_FRED(c("CCUSMA02TRA618N", "FPCPITOTLZGTUR"))
data1<- na.omit(data1)
names(data1)[1] <- "ınflatıon"
names(data1)[2]<-"exchangerate"
library(vars)
## Warning: package 'vars' was built under R version 4.2.3
## Zorunlu paket yükleniyor: MASS
## Zorunlu paket yükleniyor: strucchange
## Warning: package 'strucchange' was built under R version 4.2.3
## Zorunlu paket yükleniyor: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Zorunlu paket yükleniyor: sandwich
## Warning: package 'sandwich' was built under R version 4.2.3
## Zorunlu paket yükleniyor: urca
## Warning: package 'urca' was built under R version 4.2.3
## Zorunlu paket yükleniyor: lmtest
## Warning: package 'lmtest' was built under R version 4.2.3
varmodeli<-var(2:length(data1),)
library(psych)
VARselect(data1,
type = "none",
lag.max = 10)
## $selection
## AIC(n) HQ(n) SC(n) FPE(n)
## 2 2 1 2
##
## $criteria
## 1 2 3 4 5 6 7 8
## AIC(n) 2.019569 1.929521 2.036390 1.976998 1.993111 2.125575 2.253785 2.298804
## HQ(n) 2.077112 2.044608 2.209019 2.207170 2.280827 2.470834 2.656587 2.759149
## SC(n) 2.169665 2.229713 2.486677 2.577380 2.743590 3.026149 3.304454 3.499569
## FPE(n) 7.535648 6.890409 7.678731 7.256684 7.409850 8.520758 9.786451 10.381360
## 9 10
## AIC(n) 2.394870 2.417100
## HQ(n) 2.912759 2.992531
## SC(n) 3.745731 3.918056
## FPE(n) 11.640896 12.188571
var.a <- vars::VAR(data1,
lag.max = 10,
ic = "AIC",
type = "none")
summary(var.a)
##
## VAR Estimation Results:
## =========================
## Endogenous variables: ınflatıon, exchangerate
## Deterministic variables: none
## Sample size: 60
## Log Likelihood: -210.773
## Roots of the characteristic polynomial:
## 1.214 0.9592 0.4769 0.07346
## Call:
## vars::VAR(y = data1, type = "none", lag.max = 10, ic = "AIC")
##
##
## Estimation results for equation ınflatıon:
## ==========================================
## ınflatıon = ınflatıon.l1 + exchangerate.l1 + ınflatıon.l2 + exchangerate.l2
##
## Estimate Std. Error t value Pr(>|t|)
## ınflatıon.l1 1.6913932 0.1286045 13.152 < 2e-16 ***
## exchangerate.l1 0.0005603 0.0015211 0.368 0.713997
## ınflatıon.l2 -0.5795131 0.1524217 -3.802 0.000357 ***
## exchangerate.l2 -0.0005167 0.0015239 -0.339 0.735808
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 0.1551 on 56 degrees of freedom
## Multiple R-Squared: 0.9946, Adjusted R-squared: 0.9942
## F-statistic: 2567 on 4 and 56 DF, p-value: < 2.2e-16
##
##
## Estimation results for equation exchangerate:
## =============================================
## exchangerate = ınflatıon.l1 + exchangerate.l1 + ınflatıon.l2 + exchangerate.l2
##
## Estimate Std. Error t value Pr(>|t|)
## ınflatıon.l1 -0.34546 11.34381 -0.030 0.976
## exchangerate.l1 0.88541 0.13417 6.599 1.59e-08 ***
## ınflatıon.l2 0.47695 13.44465 0.035 0.972
## exchangerate.l2 0.07083 0.13442 0.527 0.600
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Residual standard error: 13.68 on 56 degrees of freedom
## Multiple R-Squared: 0.9056, Adjusted R-squared: 0.8989
## F-statistic: 134.4 on 4 and 56 DF, p-value: < 2.2e-16
##
##
##
## Covariance matrix of residuals:
## ınflatıon exchangerate
## ınflatıon 0.02381 0.2972
## exchangerate 0.29719 184.2965
##
## Correlation matrix of residuals:
## ınflatıon exchangerate
## ınflatıon 1.0000 0.1419
## exchangerate 0.1419 1.0000
serial.test(var.a)
##
## Portmanteau Test (asymptotic)
##
## data: Residuals of VAR object var.a
## Chi-squared = 40.112, df = 56, p-value = 0.9461
tail(data1)
## ınflatıon exchangerate
## 2016-12-31 3.022457 7.775134
## 2017-12-31 3.648570 11.144311
## 2018-12-31 4.839665 16.332464
## 2019-12-31 5.676495 15.176822
## 2020-12-31 7.016607 12.278957
## 2021-12-31 8.861476 19.596493
data1$ınflatıon = cumsum(data1$ınflatıon) + 100
par(mar = c(2.5,2.5,1,2.5))
plot.ts(data1$ınflatıon)

DAXinv =ts(c(data1[,1], data1$ınflatıon),
start = c(1960,62),
frequency = 1)
plot(DAXinv)
