# NOT RUN {
data("RV")
RV2 <- head(RV, 2001)
tvHAR <- tvLM (RV ~ RV_lag + RV_week + RV_month, data = RV2, bw = 20)
newx <- cbind(RV$RV_lag[2002:2004], RV$RV_week[2002:2004],
RV$RV_month[2002:2004])
forecast(tvHAR, newx, n.ahead = 3)
exogen = RV2[, c("RV_week", "RV_month")]
tvHAR2 <- tvAR(RV2$RV_lag, p = 1, exogen = exogen, bw = 20)
newexogen <- newx[, -1]
forecast(tvHAR2, n.ahead = 3, newexogen = newexogen)
data(usmacro, package = "bvarsv")
tvVAR <- tvVAR(usmacro, p = 6, type = "const", bw = c(1.8, 20, 20))
forecast(tvVAR, n.ahead = 10)
data("Kmenta", package = "systemfit")
eqDemand <- consump ~ price + income
eqSupply <- consump ~ price + farmPrice
system <- list(demand = eqDemand, supply = eqSupply)
tvOLS.fit <- tvSURE(system, data = Kmenta, est = "ll", bw = c(1.5, 1.5))
newdata <- data.frame(consump = c(95, 100, 102), price = c(90, 100, 103),
farmPrice = c(70, 95, 103), income = c(82, 94, 115))
forecast(tvOLS.fit, newdata = newdata, n.ahead = 3)
data(OECD)
tvpols <- tvPLM(lhe~lgdp+pop65+pop14+public, index = c("country", "year"),
data = OECD, method = "pooling", bw = 8.9)
newdata <- cbind(lgdp = c(10, 13), pop65 = c(9, 12),
pop14 = c(17, 30), public = c(13, 20))
forecast(tvpols, newdata = newdata, n.ahead = 2)
# }
Run the code above in your browser using DataLab