Threshold 1

Author

Niaaz

library(readxl)
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(lmtest) 
Loading required package: zoo

Attaching package: 'zoo'
The following objects are masked from 'package:base':

    as.Date, as.Date.numeric
library(sandwich)    # Robust SEs
library(pacman)
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ forcats   1.0.0     ✔ readr     2.1.5
✔ ggplot2   3.5.2     ✔ stringr   1.5.1
✔ lubridate 1.9.4     ✔ tibble    3.3.0
✔ purrr     1.1.0     ✔ tidyr     1.3.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(tseries)
Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 
library(strucchange) # Threshold & break tests

Attaching package: 'strucchange'

The following object is masked from 'package:stringr':

    boundary
library(sandwich)
library(car)
Loading required package: carData

Attaching package: 'car'

The following object is masked from 'package:purrr':

    some

The following object is masked from 'package:dplyr':

    recode
library(tsDyn)
Warning in as.POSIXlt.POSIXct(Sys.time()): unknown timezone 'Argentinië
(standaardtijd)'
library(urca)
library(cowplot)

Attaching package: 'cowplot'

The following object is masked from 'package:lubridate':

    stamp
library(GGally)
library(ggstats)
library(ggthemes)

Attaching package: 'ggthemes'

The following object is masked from 'package:cowplot':

    theme_map
library(ggvis)

Attaching package: 'ggvis'

The following object is masked from 'package:ggplot2':

    resolution
library(ggplot2)
library(moments)
dataR <- read_excel("Z:/Research/Sectie Real Sector/Notities/2025/Inflatie & economische groei/dataR.xlsx")
head(dataR)
# A tibble: 6 × 9
   Date    CPI inflation   BBP growth    GCF Ex_SRD Gov_exp    m2
  <dbl>  <dbl>     <dbl> <dbl>  <dbl>  <dbl>  <dbl>   <dbl> <dbl>
1  1980 0.0128      10   9111.  -8.8  514323   918.    587.  695.
2  1981 0.0138       7.7 9758.   7.10 678672   846.    718.  833.
3  1982 0.0147       6.3 9350.  -4.18 620343   765.    788.  920.
4  1983 0.0153       4.2 8986.  -3.90 337013   655.    801. 1017 
5  1984 0.0159       4.4 8815.  -1.90 249335   651.    766. 1216.
6  1985 0.0184      15.6 8994.   2.03 308398   563.    834. 1582.
str(dataR)
tibble [44 × 9] (S3: tbl_df/tbl/data.frame)
 $ Date     : num [1:44] 1980 1981 1982 1983 1984 ...
 $ CPI      : num [1:44] 0.0128 0.0138 0.0147 0.0153 0.0159 ...
 $ inflation: num [1:44] 10 7.7 6.3 4.2 4.4 15.6 30.2 52.2 -7.6 2.1 ...
 $ BBP      : num [1:44] 9111 9758 9350 8986 8815 ...
 $ growth   : num [1:44] -8.8 7.1 -4.18 -3.9 -1.9 ...
 $ GCF      : num [1:44] 514323 678672 620343 337013 249335 ...
 $ Ex_SRD   : num [1:44] 918 846 765 655 651 ...
 $ Gov_exp  : num [1:44] 587 718 788 801 766 ...
 $ m2       : num [1:44] 695 833 920 1017 1216 ...
dataR$log_CPI     <- log(dataR$CPI)
dataR$log_BBP     <- log(dataR$BBP)
dataR$log_GCF     <- log(dataR$GCF)
dataR$log_Ex_SRD  <- log(dataR$Ex_SRD)
dataR$log_Gov_exp <- log(dataR$Gov_exp)
dataR$log_m2      <- log(dataR$m2)
par(mfrow = c(1,2)) # 2 plots side by side hist(dataR$inflation, main="Inflation (raw)", xlab="Inflation", col="skyblue", breaks=10)
hist(dataR$growth, main="Growth (raw)", xlab="Growth", col="green", breaks=10)
par(mfrow = c(1,2))

plot(density(dataR$inflation), main="Inflation density", col="blue")
plot(density(dataR$growth), main="Growth density", col="red")

skewness(dataR$inflation)  # >0 = right skew, <0 = left skew
[1] 4.956962
skewness(dataR$growth)
[1] 3.902894
adf.test(dataR$growth)

    Augmented Dickey-Fuller Test

data:  dataR$growth
Dickey-Fuller = -2.6184, Lag order = 3, p-value = 0.329
alternative hypothesis: stationary
pp.test(dataR$growth)
Warning in pp.test(dataR$growth): p-value smaller than printed p-value

    Phillips-Perron Unit Root Test

data:  dataR$growth
Dickey-Fuller Z(alpha) = -53.793, Truncation lag parameter = 3, p-value
= 0.01
alternative hypothesis: stationary
pp.test(dataR$log_CPI)

    Phillips-Perron Unit Root Test

data:  dataR$log_CPI
Dickey-Fuller Z(alpha) = -4.2952, Truncation lag parameter = 3, p-value
= 0.8625
alternative hypothesis: stationary
pp.test(dataR$log_BBP)

    Phillips-Perron Unit Root Test

data:  dataR$log_BBP
Dickey-Fuller Z(alpha) = -4.8042, Truncation lag parameter = 3, p-value
= 0.8306
alternative hypothesis: stationary
pp.test(dataR$log_GCF)

    Phillips-Perron Unit Root Test

data:  dataR$log_GCF
Dickey-Fuller Z(alpha) = -5.0535, Truncation lag parameter = 3, p-value
= 0.8149
alternative hypothesis: stationary
pp.test(dataR$log_Ex_SRD)

    Phillips-Perron Unit Root Test

data:  dataR$log_Ex_SRD
Dickey-Fuller Z(alpha) = -19.926, Truncation lag parameter = 3, p-value
= 0.04323
alternative hypothesis: stationary
pp.test(dataR$log_Gov_exp)

    Phillips-Perron Unit Root Test

data:  dataR$log_Gov_exp
Dickey-Fuller Z(alpha) = -6.9359, Truncation lag parameter = 3, p-value
= 0.697
alternative hypothesis: stationary
pp.test(dataR$log_m2)

    Phillips-Perron Unit Root Test

data:  dataR$log_m2
Dickey-Fuller Z(alpha) = -7.9312, Truncation lag parameter = 3, p-value
= 0.6346
alternative hypothesis: stationary
diff_log_BBP <- diff(dataR$log_BBP)
diff_log_CPI <- diff(dataR$log_CPI)
diff_log_GCF <- diff(dataR$log_GCF)
diff_log_Gov_exp <- diff(dataR$log_Gov_exp)
diff_log_m2 <- diff(dataR$log_m2)
pp.test(diff_log_CPI, type = "Z(alpha)")

    Phillips-Perron Unit Root Test

data:  diff_log_CPI
Dickey-Fuller Z(alpha) = -20.146, Truncation lag parameter = 3, p-value
= 0.04009
alternative hypothesis: stationary
pp.test(diff_log_BBP, type = "Z(alpha)")
Warning in pp.test(diff_log_BBP, type = "Z(alpha)"): p-value smaller than
printed p-value

    Phillips-Perron Unit Root Test

data:  diff_log_BBP
Dickey-Fuller Z(alpha) = -34.76, Truncation lag parameter = 3, p-value
= 0.01
alternative hypothesis: stationary
pp.test(diff_log_GCF, type = "Z(alpha)")
Warning in pp.test(diff_log_GCF, type = "Z(alpha)"): p-value smaller than
printed p-value

    Phillips-Perron Unit Root Test

data:  diff_log_GCF
Dickey-Fuller Z(alpha) = -26.656, Truncation lag parameter = 3, p-value
= 0.01
alternative hypothesis: stationary
pp.test(diff_log_Gov_exp, type = "Z(alpha)")
Warning in pp.test(diff_log_Gov_exp, type = "Z(alpha)"): p-value smaller than
printed p-value

    Phillips-Perron Unit Root Test

data:  diff_log_Gov_exp
Dickey-Fuller Z(alpha) = -42.256, Truncation lag parameter = 3, p-value
= 0.01
alternative hypothesis: stationary
pp.test(diff_log_m2, type = "Z(alpha)")
Warning in pp.test(diff_log_m2, type = "Z(alpha)"): p-value smaller than
printed p-value

    Phillips-Perron Unit Root Test

data:  diff_log_m2
Dickey-Fuller Z(alpha) = -39.618, Truncation lag parameter = 3, p-value
= 0.01
alternative hypothesis: stationary
diff_growth <- diff(dataR$growth)
adf.test(diff_growth)
Warning in adf.test(diff_growth): p-value smaller than printed p-value

    Augmented Dickey-Fuller Test

data:  diff_growth
Dickey-Fuller = -5.0263, Lag order = 3, p-value = 0.01
alternative hypothesis: stationary
ggplot(dataR, aes(x = inflation, y = growth)) +
  geom_point(color = "purple") +
  geom_smooth(method = "lm", color = "green", se = FALSE) +
  labs(title = "Inflation vs Growth",
       x = "Inflation (%)",
       y = "Growth (%)") +
  theme_minimal()
`geom_smooth()` using formula = 'y ~ x'

pp.test(dataR$inflation)
Warning in pp.test(dataR$inflation): p-value smaller than printed p-value

    Phillips-Perron Unit Root Test

data:  dataR$inflation
Dickey-Fuller Z(alpha) = -27.008, Truncation lag parameter = 3, p-value
= 0.01
alternative hypothesis: stationary
pp.test(dataR$growth)
Warning in pp.test(dataR$growth): p-value smaller than printed p-value

    Phillips-Perron Unit Root Test

data:  dataR$growth
Dickey-Fuller Z(alpha) = -53.793, Truncation lag parameter = 3, p-value
= 0.01
alternative hypothesis: stationary
# Eerste verschil van growth
diff_growth <- diff(dataR$growth)

# Eerste verschil van inflation
diff_inflation <- diff(dataR$inflation)

dataR$diff_growth <- c(NA, diff_growth)   # voeg NA aan het begin toe om lengte gelijk te maken
dataR$diff_inflation <- c(NA, diff_inflation)
plot(dataR$diff_inflation, dataR$diff_growth)