"README.md" did not exist on "73116adf4b3fec621d487477a57b45bcd9a57491"
Newer
Older
#' @title quantile_prediction
#'
#' @description This function plots the quantiles
#' @param Lfor List of the data needed to plot
#' @export
#' @examples
#' plotprob()
quantile_predict <- function(model, datatr){
Yhat <- lapply(model$tau, function(q){
yHat <- sapply(model$kseq, function(k){
## Setup the design matrix for k step
X <- as.data.frame(subset(datatr, kseq=k))
## Lag them to match to the
#X <- onlineforecast:::lagdf.matrix(X, k)
yhat <- as.numeric(rep(NA, nrow(X)))
for(i in ((k):nrow(X))){
if(i <= (model$N1)) {
j <- 1
} else{
j <- i - model$N1
}
#browser()
yhat[i] <- t(as.numeric(X[i,])) %*% model$beta[[paste0("q",q)]][[paste0("k",k)]][j,]
}
return(yhat)
})
nams(yHat) <- pst("k", model$kseq)
return(yHat)
})
names(Yhat) <- pst("q", model$tau)
return(Yhat)
}