How to set p and q in ARMA model?

7 visualizzazioni (ultimi 30 giorni)
Hamed Majidiyan
Hamed Majidiyan il 16 Mar 2022
Risposto: Karanjot il 26 Set 2023
Hi,
I'm pretty new to time-series forcasting, and I wanted to use an ARMA model for my measurement data using the BIC code that is given on Matchwork as follow, however, I got an error no matter how time series I have used. Also, I was wondering how the order 0 for p and q could be determined in the output, since we can define the matrix with 0 row and column, so any help would be highly appreciated.
code
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)
Error
Error using BIC_Predictor (line 6)
Estimated variance model is invalid.
Caused by:
Error using arima/validateModel (line 1152)
Nonseasonal autoregressive polynomial is unstable.
Regards

Risposte (1)

Karanjot
Karanjot il 26 Set 2023
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:
  1. 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.
  2. 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.
  3. 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)
BIC = 4×4
-122.0552 -117.4500 -112.8449 -108.2397 -117.4500 -112.8449 -108.2397 -103.6345 -112.8449 -108.2397 -103.6345 -99.0294 -108.2397 -103.6345 -99.0294 -94.4242
minBIC = min(BIC,[],'all')
minBIC = -122.0552
[minP,minQ] = find(minBIC == BIC)
minP = 1
minQ = 1
To learn more about the ‘arima’ function, please refer to the below documentation:
I hope this helps!

Categorie

Scopri di più su Conditional Mean Models in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by