I have a time series problem where I could easily work out the solution manually. The only problem is that it would take a long time since I have 4 different AR(2) processes and want to calculate at least the first 20 lagged correlations for each.. I still have R on my PC from previous work which was much easier though and I feel like I forgot everything I knew about it, So I'm sitting in front of it not knowing how to work this out. What I want to do is use the Yule-Walker equation for rho as follows:
I got an (actually four, but lets just do one for the sake of it) autoregressive process of second order, AR(2) Phi(1) is 0.6 and Phi(2) is 0.4.
I want to calculate the correlation coefficients rho(k) for all lags up to k=20.
So rho(0) would naturally be 1 and rho(-1) = rho(1) therefore
rho(1) = phi(1) + phi(2)*rho(1)
rho(k) = phi(1)*rho(k-1) + phi(2)*rho(k-2)
Now I want to solve this in R. But I have no idea how to do it. Can anyone help me out here?
I'd be very grateful!
Thanks. Max