问题
I am validating Arima models and I would like to know the critical value of my test to reject the null hypthesis depending on the p-value. If a want a confidence of 95%. which is my critical value.
1-pchisq(-2*(try2$loglik-try1$loglik),1)
0.1817151
1-pchisq(-2*(try3$loglik-try2$loglik),1)
1
Where try1, try2 and try3 are three different models. Thanks!
回答1:
You need to provide a little bit more info, but I think I see what you're trying to do.
Your null hypothesis is that the two models do not provide the same goodness of fit - one model is not "better" than another. Generally, you test each model against a baseline model. The interpretation of your results is this: none of the models are significantly different (at a 5% significance level).
By using 1 degree of freedom, you imply that a single independent variable is added in each model. For example, try1 has 1 independent variable, try2 has 2, and try3 has 3. Also keep in mind that you absolutely must have the same dependent variable for this to be valid.
回答2:
Cross validation for ARIMA (AutoRegressive Integrated Moving Average) time series: K-fold cross validation does not work for time-series. Instead, use backtesting techniques like walk-forward and rolling windows.
K-fold cross-validation for autoregression: Although cross-validation is (usually) not valid for time series (ARIMA) models, K-fold works for autoregressions as long as the models considered have uncorrelated errors, and you have tested it with the Ljung Box Test, for XAI (Explainable Artificial Intelligence) in time series use cases.
There are a few Python statistics libs that have these methods avail, here are two: Python Stats Tests and Python StatsModels.
You can always study the Python APIs and refactor into R quite easily.
To get the diff of values, you can simply enforce int8's using Python 3.6+ PEP 487 Descriptors, where you can enforce a type list that always returns int8's, for faster computation as well (list : list -> list of ints):
list_a = [1,2,3]
list_b = [2,3]
print(set(list_a).difference(set(list_b)))
answer is set([1])
来源:https://stackoverflow.com/questions/15880278/test-arima-model