When estimating this VAR-model the returned coefficients on BNP.min4 and INT.min4 are NA, which I do not understand. My intuition is that there should not be any collinearity between these variables. The reason for the dummy's is to make the residuals normal, so by excluding the biggest outliers.
If anyone has any thought on why R is returning NA's on these dummy's and how to solve this that would be really helpful!
Below you will find the R code to recreate the results:
library(quantmod)
library(urca)
library(vars)
library(seasonal)
library(xtable)
library(tseries)
#Constant Price Gross Domestic Product in Sweden, Seasonally Adjusted
#Percent Change from Year Ago, Quarterly, Seasonally Adjusted
getSymbols("SWEGDPRQPSMEI", src = "FRED")
BNP <- ts(as.ts(SWEGDPRQPSMEI), start = c(1961, 1), frequency = 4)
#Unemployment Rate: Aged 15-64: All Persons for Sweden
#Percent, Quarterly, Seasonally Adjusted
getSymbols("LRUN64TTSEQ156S", src = "FRED")
U <- ts(as.ts(LRUN64TTSEQ156S), start = c(2001, 1), frequency = 4)
#Consumer Price Index: Total All Items for Sweden Growth Rate Previous Period,
#Not Seasonally Adjusted
getSymbols("CPALTT01SEQ657N", src = "FRED")
CPI <- ts(as.ts(CPALTT01SEQ657N), start = c(1960, 1), frequency = 4)
#Global price of Brent Crude
#U.S. Dollars per Barrel, Not Seasonally Adjusted
getSymbols("POILWTIUSDQ", src = "FRED")
OIL <- ts(as.ts(POILWTIUSDQ), start = c(1990, 1), frequency = 4)
OIL <- log(OIL)
#3-Month or 90-day Rates and Yields: Treasury Securities for Sweden
#Percent,Not Seasonally Adjusted
getSymbols("IR3TTS01SEQ156N", src = "FRED")
INT <- ts(as.ts(IR3TTS01SEQ156N), start = c(1982, 1), frequency = 4)
##SEASON AJDUSt##
# seasonal adjust time series using X11.
CPI1 <- final(seas(as.ts((CPI),freq=4)))
OIL1 <- final(seas(as.ts((OIL),freq=4)))
sweden.data <- ts.intersect(OIL, U, BNP, CPI, INT)
#OIL & CPI S.ADJ
sweden.data1 <- ts.intersect(OIL1, U, BNP, CPI1, INT)
plot(sweden.data)
plot(sweden.data1)
# save(okun, file = "okun.rda")
# Data nedladdade 2018-12-11.
var.data1 <- window(sweden.data1, start=c(2001, 1), end=c(2019, 1))
var.sa <- ts.intersect(diff(var.data1[, "OIL1"]), diff(var.data1[, "U"]), var.data1[,"BNP"],var.data1[,"CPI1"], var.data1[,"INT"])
colnames(var.sa) <-c("DOIL", "DU","BNP","CPI","INT")
var.sa #OIL, Unemployment diffade
model.sa1<-VAR(var.sa, type = c("const"), p=1 ,ic = c("AIC"))
res.sa1<-residuals(model.sa1)
DOIL.min4 <- res.sa1[, "DOIL"] == min(res.sa1[, "DOIL"])
DU.max4 <- res.sa1[,"DU"] == max(res.sa1[,"DU"])
BNP.min4 <- res.sa1[, "BNP"] == min(res.sa1[, "BNP"])
INT.min4 <- res.sa1[, "INT"] == min(res.sa1[, "INT"])
var.sa.extDD <- cbind(DOIL.min4, DU.max4, BNP.min4,INT.min4)
var.sa.DD <- window(var.sa, start=c(2001, 3))
model.sano1<-VAR(var.sa.DD, type= "const", p=1, exogen = var.sa.extDD)
model.sano1
Estimated coefficients for equation INT:
========================================
Call:
INT = DOIL.l1 + DU.l1 + BNP.l1 + CPI.l1 + INT.l1 + const + DOIL.min4 + DU.max4 + BNP.min4 + INT.min4
DOIL.l1 DU.l1 BNP.l1 CPI.l1 INT.l1 const DOIL.min4 DU.max4 BNP.min4
0.79386673 -0.27122335 0.04046045 0.04209832 0.97891032 -0.12187917 -1.30325783 -0.12248275 NA
INT.min4
NA