#' Test uniform Superior Predictive Ability
#'
#' Implements the test for uniform Superior Predictive Ability (uSPA) of Quaedvlieg (2021)
#' @param LossDiff the T x H matrix forecast path loss differential
#' @param L the parameter for the moving block bootstrap
#' @param B integer, the number of bootstrap iterations. Default 999
#' @return A list containing two objects:
#' \item{"p_value"}{the p-value for uSPA}
#' \item{"t_uSPA"}{the statistics for uSPA}
#' @references Quaedvlieg, Rogier. "Multi-horizon forecast comparison." Journal of Business & Economic Statistics 39.1 (2021): 40-53.
#' @seealso \code{\link{Test_aSPA}}
#' @examples
#' ## Test for uSPA
#'
#' Trow <- 200
#' H <- 12
#' Mmethods <- 5
#' Losses <- matrix(rnorm(Trow*H, mean = 0), nrow = Trow, ncol = H)
#'
#' Test_uSPA(LossDiff=Losses, L=3, B=5)
#'
#' @author Luca Barbaglia \url{https://lucabarbaglia.github.io/}
#'
#' @export
Test_uSPA <- function(LossDiff, L, B=999){
if (!is.matrix(LossDiff)){LossDiff <- as.matrix(LossDiff)}
bootout <- Bootstrap_uSPA(LossDiff, L, B)
p_value <- mean(bootout$t_uSPA < bootout$t_uSPA_b)
return(list("p_value"=p_value, "t_uSPA"=bootout$t_uSPA))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.