The computation of the performance relative to the benchmarks is not correct in the tests for superior predictive ability. The formula you state in the theoretic overview is Loss_Benchmark - Loss_Alternatives. However, in your function hansen.spa the first line is:
d.mat <- apply(Dmat, 2, function(x) x - bVec).
So, you reversed it. This leads to wrong conclusions regarding p-values.
The computation of the performance relative to the benchmarks is not correct in the tests for superior predictive ability. The formula you state in the theoretic overview is Loss_Benchmark - Loss_Alternatives. However, in your function hansen.spa the first line is:
d.mat <- apply(Dmat, 2, function(x) x - bVec).
So, you reversed it. This leads to wrong conclusions regarding p-values.