I am learning estimation methods following the book of Steven Kay, "Fundamentals of Statistical Processing, Volume I: Estimation Theory "
Theory says that if the measurement noise is Gaussian, the OLS = MLE. However, in the noise-free case, why am I not getting the true estimates? I have not checked for the noisy case. Can somebody please help in correcting my code and the concept as to why none of the estimation methods such as the yule-walker, OLS and MLE are working to give the true estimates of an AR(2) model. Where am I going wrong?
clear
h =[1,0.195,- 0.95]; %true coeffficients
L=length(h);
N=256;
x=round(randn(1,N)); %driving signal
y = filter(1,h,x); % generate the AR(2) model
arcoeffs_yule = aryule(y ,2)
arcoeff_mle = mle(y)
Y=y';
x=x';
arcoeffs_ols = [Y -[0;Y(1:end-1)] -[0;x(1:end-1)]]\x
arcoeffs_yule =
1.0000 0.9285 0.0000
arcoeff_mle =
1.0e+07 *
-0.0941 7.8185
arcoeffs_ols =
0.1405
-0.1513
0.1527
UPDATE to the code: based on the comment, I have put the length of the AR model=3 inside aryule
instead of passing the order 2. Then I have passed some initial values to the filtered signal. Yet getting incorrect estimates.
clear
h =[1,0.195,- 0.95]; %true coeffficients
L=length(h);
N=256;
x=round(randn(1,N)); %driving signal
y(1) = 0.1;
y(2) = 0.2;
% Generate the AR model.
for i =3 : N
y(i) = 0.195 *y(i-1) -0.95*y(i-2) + x(i);
end
%y = filter(1,h,x);
arcoeffs_yule = aryule(y,L)
arcoeffs_mle = mle(y)
Y=y';
x=x';
arcoeffs_ols = [Y -[0;Y(1:end-1)] -[0;x(1:end-1)]]\x
arcoeffs_yule =
1.0000 -0.0420 0.9202 0.1261
arcoeffs_mle =
0.0040 2.9161
arcoeffs_ols =
0.1108 0.0263 0.1613
y
which did was not bell shaped. $\endgroup$