target <- "s"
if (target == "l"){
xx <- seq(1:nrow(long_term))
tmp <- data.frame(x = seq(1:nrow(long_term)), dau=long_term$dau)
} else {
xx <- seq(1:nrow(short_term))
tmp <- data.frame(x = seq(1:nrow(short_term)), dau=short_term$dau)
}
fit1 <- rlm(dau ~ x, data=tmp)
fit.data <- data.frame(predict(fit1, data.frame(x=xx), interval="prediction", level=.95))
newdata <- data.frame(x = (max(xx)+1):(max(xx)+7))
pred1 <- data.frame(predict(fit1, newdata, interval="confidence", level=.95))
d1 <- data.frame(x=xx, dau=tmp$dau)
d2 <- data.frame(x=newdata, dau=pred1$fit)
d <- sqldf("
select * from d1
union all
select * from d2
")
plot(d)
lines(xx, fit.data$fit, col="black")
lines(xx, fit.data$lwr, col="blue")
lines(xx, fit.data$upr, col="red")
lines(newdata$x, pred1$fit, col="black", lty="dashed")
lines(newdata$x, pred1$lwr, col="blue", lty="dashed")
lines(newdata$x, pred1$upr, col="red", lty="dashed")