# 4.7. Criteria for Parametric methods¶

In order to estimate the order of a parametric model, one chose a PSD method such as the aryule() function. This function (when given an order) returns a list of AR parameters. The order selected may not be optimal (too low or too high). One tricky question is then to find a criteria to select this order in an optiaml way. Criteria are available and the following example illustrate their usage.

## 4.7.1. Example 1¶

Let us consider a data set (the Marple data already used earlier). We use the aryule function to estimate the AR parameter. This function also returns a parameter called rho. This parameter together with the length of the data and the selected order can be used by criteria functions such as the AIC() function to figure out the optimal order.

from spectrum import *
from pylab import *

order = arange(1, 25)
rho = [aryule(marple_data, i, norm='biased')[1] for i in order]
plot(order, AIC(len(marple_data), rho, order), label='AIC')

[hires.png, pdf]

The optimal order corresponds to the minimal of the plotted function.

## 4.7.2. Example 2¶

We can look at another example that was look at earlier with a AR(4):

import scipy.signal
from spectrum import *
from pylab import *

# Define AR filter coefficients and some data accordingly
a = [1, -2.2137, 2.9403, -2.1697, 0.9606];
x = scipy.signal.lfilter([1], a, randn(1,256))

# study different order
order = arange(1, 25)
rho = [aryule(x[0], i, norm='biased')[1] for i in order]
plot(order, AIC(len(x[0]), rho, order), label='AIC')

[hires.png, pdf]

Here, is appears that an order of 4 (at least) should be used, which correspond indeed to the original choice.