I'm trying to estimate a simultaneous equations system using systemfit
, but cannot seem to specify inequalities as constraints. I've recreated the problem using the airquality
dataset, the issue arises when adding inequalities to the restrict.matrix
argument. Is there any workaround to get this example to work?
require(systemfit)
lagAQ <- rbind(NA, airquality[1:nrow(airquality)-1,])
colnames(lagAQ) <- paste("lag", colnames(lagAQ), sep = "")
data <- data.frame(airquality, lagAQ)
eqOzone <- Ozone ~ lagOzone + lagWind + lagTemp
eqWind <- Wind ~ lagOzone + lagWind + lagTemp
eqTemp <- Temp ~ lagOzone + lagWind + lagTemp
airSystem <- list(ozone = eqOzone, wind = eqWind, temp = eqTemp)
constr <- c("ozone_(Intercept) = 0",
"wind_(Intercept) = 0",
"temp_(Intercept) = 0",
"ozone_lagOzone > 0",
"ozone_lagWind > 0",
"ozone_lagTemp > 0",
"ozone_lagOzone + wind_lagOzone + temp_lagOzone = 1",
"ozone_lagWind + wind_lagWind + temp_lagWind = 1",
"ozone_lagTemp + wind_lagTemp + temp_lagTemp = 1"
)
airModel <- systemfit(airSystem, restrict.matrix = constr, data = data)