As discussed, I am implementing estimation methods for phi
in AR
modelling. We covered yule_walker
earlier, I’ll write a post about that. After it’s implementation, we go ahead with another estimation method  Levinson Durbin
LevinsonDurbin requires timeline series to be demeaned(series = series  series.mean
) and it’s autocovavirance.
Autocovariance of series is represented by summation of summation of product of series with series at lag k
. That is, summation of (x_i * x_{i+lag})
. It is also directly related with acf
of series as acf(k) = acvf(h) / acvf(0)
. It’s code can now be found in Statsample::TimeSeries
’s acvf
method.
Now, with the help of autocovariance series, our levinson_durbin
function recursively computes the following parameters:
 sigma_v : estimation of error variance
 arcoefs : AR phi values for timeseries
 pac : unbiased levinson pacf estiation
 sigma : sigma for AR.
LD performs recursive matrix and vector multiplications to populate it’s toeplitz matrix. Here is some code depicting those manipulations:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 

Implementation can be found here.
Now, in this week, I will integrate this in AR modelling and perform some tests to verify the estimation. And will soon start with next estimation method :)
Cheers,
Ankur Goel