Estimate model order of an autoregressive (AR) model

949 Views Asked by At

I am trying to use pmcov() function of MATLAB to calculate power spectral density estimates (PSD) of a discrete time signal 700 ms long with sampling frequency 1000 Hz. This function requires the model order of the autoregressive model used to produce the PSD estimates.

How can I estimate this model order to predict the correctness of the fit?. I came know that there are few criterion like AIC,BIC,GIC which can be used to estimate model order but could not find how to use them in matlab. Can anyone help? My input time signal is a [700 129] matrix.

Thanks a lot!

1

There are 1 best solutions below

0
On

If your signals are reliably smooth, you could probably just look at the autocorrelation function for each trial and pick the set the order as the lag when the ACF starts to decay.

autocorr(Y);

If you want to get a more quantitative fit (which is probably easier than eyeballing and generalizing 129 signals). You can fit an AR model

First thing you'll do is choose the order range you want to evaluate (I would look at the ACF for a couple of signals and pick an order where there's relatively no signal in the ACF).

bounds = 1:12; % Order bounds

Now you'll iterate through each order possibility and compute the AIC, BIC. Lower values == better fit.

for p = bounds
   myModel = arima(p,0,0);      % no moving average (I'm not sure about no MA...)
   for sig_ind = 1:size(sig_mat,2)
        % Get the log likelihoods
        [~,~,LL(p,sig_ind)]= estimate(myModel,sig_mat(:,sig_ind));
    end
end
for sig_ind = 1:size(sig_mat,2)
    [aic(sig_ind,:),bic(sig_ind,:)] = aicbic(LL(:,sig_ind),bounds,size(sig_mat,1));
end

So now you have your BIC scores you want to pick the lowest. In this case I use the mean across signals, if you want to be real careful I would look at the distributions and pick a low
median with a tight distribution. You could also use the AIC to evaluate.

[~,order_ind] = min(mean(bic,1));
order = bound(order_ind);