Prev: nonlinear newton raphson iteration code
Next: Unsupported Matlab functions when building model in Real-Time Workshop
From: Wayne King on 19 Apr 2010 13:30 "Rogelio" <rogelio.a.mancisidor(a)student.bi.no> wrote in message <hqgvvl$7ge$1(a)fred.mathworks.com>... > Hello, > Does any body know how to open the m.file containing the Levinson-Durbin algorithm? The point is that if I used the fucntion aryule to estimate ar coefficients I get some estimates that are far away from the theoretical ones (based on my example). I beleive that the problem can be done by the way the autovariance/crosscovariance is calculated and might be the Levinson-Durbin Algorithm as well. > Any comment is appreciatted Hi Rogelio, levinson is a MEX file so you won't be able to see the actual code. Why don't you create realizations of an AR(p) process with known coefficients and see how close your coding is to that returned by aryule()? For example: reset(RandStream.getDefaultStream); Arcoeffs = [1.0000 -0.9 0.3]; x = filter(1,Arcoeffs,randn(1000,1)); ArEst = aryule(x,2); % compare ArEst and Arcoeffs % ArEst returns 1.0000 -0.9491 0.3358 That is pretty close! Wayne
From: Rogelio on 19 Apr 2010 13:39 "ade77 " <ade100a(a)gmail.com> wrote in message <hqi055$gn1$1(a)fred.mathworks.com>... > "Rogelio" <rogelio.a.mancisidor(a)student.bi.no> wrote in message <hqgvvl$7ge$1(a)fred.mathworks.com>... > > Hello, > > Does any body know how to open the m.file containing the Levinson-Durbin algorithm? The point is that if I used the fucntion aryule to estimate ar coefficients I get some estimates that are far away from the theoretical ones (based on my example). I beleive that the problem can be done by the way the autovariance/crosscovariance is calculated and might be the Levinson-Durbin Algorithm as well. > > Any comment is appreciatted > > To open a function, type: > edit functionname, > > most of the theory on this algorithm uses more of autocorrelation,and cross correlation The levinson algorithm is a .mex file, so I cannot open. I am pretty sure that the difference is in the way the autocorrelation and/or crosscorrelation is computed. Moreover, aryule funtion doesnt provide the covariance matrix for the coefficientes and this can be easily modifed in the levinson algorithm or computed beside the algorihm. However, this is a flaw in the algorithm.
From: Rogelio on 19 Apr 2010 13:50 "Rogelio" <rogelio.a.mancisidor(a)student.bi.no> wrote in message <hqi4fo$50v$1(a)fred.mathworks.com>... > "ade77 " <ade100a(a)gmail.com> wrote in message <hqi055$gn1$1(a)fred.mathworks.com>... > > "Rogelio" <rogelio.a.mancisidor(a)student.bi.no> wrote in message <hqgvvl$7ge$1(a)fred.mathworks.com>... > > > Hello, > > > Does any body know how to open the m.file containing the Levinson-Durbin algorithm? The point is that if I used the fucntion aryule to estimate ar coefficients I get some estimates that are far away from the theoretical ones (based on my example). I beleive that the problem can be done by the way the autovariance/crosscovariance is calculated and might be the Levinson-Durbin Algorithm as well. > > > Any comment is appreciatted > > > > To open a function, type: > > edit functionname, > > > > most of the theory on this algorithm uses more of autocorrelation,and cross correlation > > > The levinson algorithm is a .mex file, so I cannot open. I am pretty sure that the difference is in the way the autocorrelation and/or crosscorrelation is computed. Moreover, aryule funtion doesnt provide the covariance matrix for the coefficientes and this can be easily modifed in the levinson algorithm or computed beside the algorihm. However, this is a flaw in the algorithm. The main difference is the variance estimate. This is more or less fixed by using the autocovariance function insted of the autocorrelation (in the aryule algorithm). This two alternatives are, mathematically, identical. Does any one can tell me what I am missing??
From: Wayne King on 19 Apr 2010 13:52 "Rogelio" <rogelio.a.mancisidor(a)student.bi.no> wrote in message <hqi4fo$50v$1(a)fred.mathworks.com>... > "ade77 " <ade100a(a)gmail.com> wrote in message <hqi055$gn1$1(a)fred.mathworks.com>... > > "Rogelio" <rogelio.a.mancisidor(a)student.bi.no> wrote in message <hqgvvl$7ge$1(a)fred.mathworks.com>... > > > Hello, > > > Does any body know how to open the m.file containing the Levinson-Durbin algorithm? The point is that if I used the fucntion aryule to estimate ar coefficients I get some estimates that are far away from the theoretical ones (based on my example). I beleive that the problem can be done by the way the autovariance/crosscovariance is calculated and might be the Levinson-Durbin Algorithm as well. > > > Any comment is appreciatted > > > > To open a function, type: > > edit functionname, > > > > most of the theory on this algorithm uses more of autocorrelation,and cross correlation > > > The levinson algorithm is a .mex file, so I cannot open. I am pretty sure that the difference is in the way the autocorrelation and/or crosscorrelation is computed. Moreover, aryule funtion doesnt provide the covariance matrix for the coefficientes and this can be easily modifed in the levinson algorithm or computed beside the algorihm. However, this is a flaw in the algorithm. Rogelio, see my post in the thread. From what I see aryule() gets very close when you feed it realizations of an AR(p) process generated with known coefficients. Can you provide an example of where it does not? Wayne Wayne
From: Rogelio on 19 Apr 2010 15:17
"Wayne King" <wmkingty(a)gmail.com> wrote in message <hqi585$j1t$1(a)fred.mathworks.com>... > "Rogelio" <rogelio.a.mancisidor(a)student.bi.no> wrote in message <hqi4fo$50v$1(a)fred.mathworks.com>... > > "ade77 " <ade100a(a)gmail.com> wrote in message <hqi055$gn1$1(a)fred.mathworks.com>... > > > "Rogelio" <rogelio.a.mancisidor(a)student.bi.no> wrote in message <hqgvvl$7ge$1(a)fred.mathworks.com>... > > > > Hello, > > > > Does any body know how to open the m.file containing the Levinson-Durbin algorithm? The point is that if I used the fucntion aryule to estimate ar coefficients I get some estimates that are far away from the theoretical ones (based on my example). I beleive that the problem can be done by the way the autovariance/crosscovariance is calculated and might be the Levinson-Durbin Algorithm as well. > > > > Any comment is appreciatted > > > > > > To open a function, type: > > > edit functionname, > > > > > > most of the theory on this algorithm uses more of autocorrelation,and cross correlation > > > > > > The levinson algorithm is a .mex file, so I cannot open. I am pretty sure that the difference is in the way the autocorrelation and/or crosscorrelation is computed. Moreover, aryule funtion doesnt provide the covariance matrix for the coefficientes and this can be easily modifed in the levinson algorithm or computed beside the algorihm. However, this is a flaw in the algorithm. > > Rogelio, see my post in the thread. From what I see aryule() gets very close when you feed it realizations of an AR(p) process generated with known coefficients. Can you provide an example of where it does not? > > Wayne > > Wayne I had simulated an AR(p) process and I saw what you pointed, however for real data there is a significant discrepancy. Let me tell you my example from a book. At http://stat.pitt.edu/stoffer/tsa2/ under CHAPTER1 theres is a data set called recruit.dat. Then try this for an AR(2): %first OLS to estimate parameters y=importdata('recruit.dat'); xx=lagmatrix(A,1:2); X=[ones(453,1) xx]; [b bint r rint stat]=regress(A,X); varhat=stat(4); %now the Yule-Walker [a e]=aryule(A,2); If you compare the variance estimate in the OLS and in the Yule-Walker the difference is 18.8338, while the coefficients are closer. Now if I modified the aryule function in the line 37 and instead of xcorr I use xcov (in both I used the biased form) the difference in the variance estimate is now 3.85 and the coefficients are even closer to OLS. Now, while wirtting this post I realized that the difference in the variance estimates is due to the fact that regress uses the unbiased formula, while I was using the biased formula for both xcov and xcorr. However, the difference in the variance estimate for xcorr vs OLS is higher than xcov VS OLS. It seems that the Yule-Walker algorithm is better behaved for autocovariances than autocorrelations for nonsimulated data. Eventhoug both formulations, autocovariance and autocorrelation, are mathematically equivalent. We would need to see the levinson algorithim to see whats going on. |