Hi Hamed,
I understand that want to debug the following error in your ARMA model:
%{
Error using BIC_Predictor (line 6)
Estimated variance model is invalid.
Caused by:
Error using arima/validateModel (line 1152)
Nonseasonal autoregressive polynomial is unstable.
%}
Please provide the data / variables associated with the code you shared. Meanwhile, I recommend observing the following:
- Ensure that the input data ‘Con_mat’ is correctly formatted and appropriate for the ARIMA model. It should be a non-empty column vector of numeric values.
- Verify that the parameter values used for the ARIMA model are valid. For example, check if the order of the AR and MA components (‘p’ and ‘q’) is within a reasonable range.
- Try adjusting the model order ‘p’ or using a different model specification that better suits your data.
The error is resolved by ensuring the above points. Here’s an example:
Con_mat = zeros(10,1); % Initialize as column vector appropriate for the model
LogL = zeros(4,4); % Initialize
PQ = zeros(4,4);
for p = 1:4
for q = 1:4
Mdl = arima(p,0,q);
[EstMdl,~,LogL(p,q)] = estimate(Mdl,Con_mat,'Display','off');
PQ(p,q) = p + q;
end
end
logL = LogL(:);
pq = PQ(:);
[~,bic] = aicbic(logL,pq+1,100);
BIC = reshape(bic,4,4)
minBIC = min(BIC,[],'all')
[minP,minQ] = find(minBIC == BIC)
To learn more about the ‘arima’ function, please refer to the below documentation:
I hope this helps!