Closed SantiagoD999 closed 10 months ago
With only 20 observations, you can't have h=21
. I've added a check to return a better error message when this occurs.
Thank you, but that means that the definition of the function: dm.test(e1,e2),h=21, varestimator = "bartlett") for N 21-ahead forecasts (where N>h), is correct?
Yes, I believe the function is correct.
Good morning professor Hyndman,
Working with your excellent package forecast, I am using the dm.test function. I want to compare twenty 21 step-ahead forecasts, but I am not sure if the correct way of defining the dm.test function is dm.test(e1,e2),h=21, varestimator = "bartlett"), because I get this warning:
Warning message: In 2 (1 - b/(m + 1)) d.cov[-1] : longer object length is not a multiple of shorter object length
Here I send an small reproducible example supposing x and y are twenty 21-step ahead forecasts produced by some model.
set.seed(1) x<-ts(rnorm(20)) y<-ts(rnorm(20)) autoplot(x)+autolayer(y) dm.test(as.numeric(x),as.numeric(y),h=21,varestimator = "bartlett")
Thank you ver much.