'Why are NaNs produced for pchisq?

i was using serial.test to check for autocorrelation for my VAR, but I received a warning message stating Warning messages: 1: In pchisq(STATISTIC, df = PARAMETER) : NaNs produced 2: In pchisq(STATISTIC, df = PARAMETER) : NaNs produced

So when I run serial.test, I could not obtain a p-value:

 Portmanteau Test (asymptotic)
data:  Residuals of VAR object Model1
Chi-squared = 170.59, df = -160, p-value = NA

What can I do to get a p-value? Thank you!

nan


Solution 1:[1]

It is likely your VAR model has an order higher or equal than the parameter "lags.pt" of the serial.test function, which is set to 16 by default.

Check the number of lags in your var (var$p, where "var" is your fitted model) and set lags.pt to an equal or higher value to get a p-value.

You can ask on CrossValidated for a more theoretical explanation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 K9K9