Estimate autoregressive (AR) all-pole model using Yule-Walker method
ar_coeffs = aryule(data,order)
[ar_coeffs,NoiseVariance] = aryule(data,order)
[ar_coeffs,NoiseVariance,reflect_coeffs] = aryule(data,order)
ar_coeffs = aryule(data,order) returns the AR coefficients for the input data and model order. The elements of ar_coeffs are normalized by ar_coeffs(1). order is a positive integer that cannot exceed the length of the input data.
[ar_coeffs,NoiseVariance] = aryule(data,order) returns the estimated variance NoiseVariance of the white noise input.
[ar_coeffs,NoiseVariance,reflect_coeffs] = aryule(data,order) returns the reflection coefficients reflect_coeffs.
Create an AR(4) process and estimate the coefficients:
A=[1 -2.7607 3.8106 -2.6535 0.9238]; % AR(4) coefficients y=filter(1,A,0.2*randn(1024,1)); %filter a white noise input to create AR(4) process ar_coeffs=aryule(y,4); %compare the results in ar_coeffs to the vector A.
Estimate model order using decay of reflection coefficients:
rng default; y=filter(1,[1 -0.75 0.5],0.2*randn(1024,1)); %create AR(2) process [ar_coeffs,NoiseVariance,reflect_coeffs]=aryule(y,10); % Fit AR(10) model stem(reflect_coeffs); axis([-0.05 10.5 -1 1]); title('Reflection Coefficients by Lag'); xlabel('Lag'); ylabel('Reflection Coefficent');
The reflection coefficients decay to zero after lag 2, which indicates that an AR(10) model significantly overestimates the time dependence in the data.
In an AR model of order p, the current output is a linear combination of the past p outputs plus a white noise input. The weights on the p past outputs minimize the mean-square prediction error of the autoregression. If y[n] is the current value of the output and x[n] is a zero-mean white noise input, the AR(p) model is:
The reflection coefficients are the partial autocorrelation coefficients scaled by (–1). The reflection coefficients indicate the time dependence between y[n] and y[n-k] after subtracting the prediction based on the intervening k-1 time steps.
aryule uses the Levinson-Durbin recursions on the biased estimate of the sample autocorrelation sequence to compute the coefficients.