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.
- Download the material here.
- Unpack the material in your directory.
- Load the data stored in the file
book.xls
.
# Load data
library(readxl)
<- read_excel("./CointegratedVARModelHandbook/book.xls")
data <- data[,colnames(data)[-1]] data
Define the number of observations and a time variable.
# Number of observations
<- nrow(data)
TT
# Define time variable
$time <- seq(as.Date("1973-01-01"), as.Date("2003-01-01"), by="quarter") data
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
$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 data
Define “permanent intervention” dummy at 1976-Q4.
# Create "permanent intervention" dummy at 1976:4
$Dp764 <- rep(0,TT)
data$Dp764[which(data$time == as.Date("1976-10-01"))] <- 1 data
Define “mean shift” dummy at 1983-Q1.
# Create "mean shift" dummy at 1983:1
$Ds831 <- rep(0,TT)
data$Ds831[which(data$time %in% seq(as.Date("1983-01-01"), as.Date("2003-01-01"), by="quarter"))] <- 1 data
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
$Dp831 <- rep(0,TT)
data$Dp831[which(data$time == as.Date("1983-01-01"))] <- 1 data
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
$Dp832 <- rep(0,TT)
data$Dp832[which(data$time == as.Date("1983-04-01"))] <- 1 data
References
Juselius, Katarina. 2006. The Cointegrated VAR Model: Methodology and Applications. Oxford University Press.