# NOT RUN {
data("RV")
RV2 <- head(RV, 2001)
TVHAR <- tvLM (RV ~ RV_lag + RV_week + RV_month, data = RV2, bw = 20)
newdata <- cbind(RV$RV_lag[2002:2004], RV$RV_week[2002:2004],
RV$RV_month[2002:2004])
forecast(TVHAR, newdata, n.ahead = 3)
data("RV")
exogen = RV[1:2001, c("RV_week", "RV_month")]
TVHAR2 <- tvAR(RV$RV_lag[1:2001], p = 1, exogen = exogen, bw = 20)
newexogen <- RV[2002:2004, c("RV_week", "RV_month")]
forecast(TVHAR2, n.ahead = 3, newexogen = newexogen)
data(usmacro, package = "bvarsv")
model.tvVAR <- tvVAR(usmacro, p = 6, type = "const", bw = c(1.8, 20, 20))
forecast(model.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(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 <- OECD[c(7, 9), 4:7]
forecast(tvpols, newdata = newdata, n.ahead = 2)
# }
Run the code above in your browser using DataLab