2 Data

This chapter contains the preparation of the data for the replication of the empirical analysis of Juselius (2006).

2.1 Load Data

Download the material for the textbook provided by Estima.

The material for the replication of the empirical analysis can be downloaded from the world wide web.

  1. Download the material here.
  2. Unpack the material in your directory.
  3. Load the data stored in the file book.xls.
# Load data
library(readxl)
data <- read_excel("./CointegratedVARModelHandbook/book.xls")
data <- data[,colnames(data)[-1]]

Define the number of observations and a time variable.

# Number of observations
TT <- nrow(data)

# Define time variable
data$time <- seq(as.Date("1973-01-01"), as.Date("2003-01-01"), by="quarter")

The data span observations from 1973-Q1 to 2003-Q1.

2.2 Dummy Variables

Construct the dummy variables.

Define “transitory intervention” dummy at 1975-Q4.

# Create "transitory intervention" dummy at 1975:4
data$Dt754 <- rep(0,TT)
data$Dt754[which(data$time == as.Date("1975-10-01"))] <- 1
data$Dt754[which(data$time == as.Date("1976-01-01"))] <- -0.5
data$Dt754[which(data$time == as.Date("1976-04-01"))] <- -0.5

Define “permanent intervention” dummy at 1976-Q4.

# Create "permanent intervention" dummy at 1976:4
data$Dp764 <- rep(0,TT)
data$Dp764[which(data$time == as.Date("1976-10-01"))] <- 1

Define “mean shift” dummy at 1983-Q1.

# Create "mean shift" dummy at 1983:1
data$Ds831 <- rep(0,TT)
data$Ds831[which(data$time %in% seq(as.Date("1983-01-01"), as.Date("2003-01-01"), by="quarter"))] <- 1

Define difference of “mean shift” dummy, i.e., “permanent intervention” dummy at 1983-Q1.

# Create difference of "mean shift" dummy, i.e., "permanent intervention" dummy, at 1983:1
data$Dp831 <- rep(0,TT)
data$Dp831[which(data$time == as.Date("1983-01-01"))] <- 1

Define lag of “permanent intervention” dummy at 1983-Q1, i.e., “permanent intervention” dummy at 1983-Q2.

# Define lag of "permanent intervention" dummy, at 1983:1
data$Dp832 <- rep(0,TT)
data$Dp832[which(data$time == as.Date("1983-04-01"))] <- 1

References

Juselius, Katarina. 2006. The Cointegrated VAR Model: Methodology and Applications. Oxford University Press.