Hi
This is Candice from Newcastle University.
I am now coming across some problems with the programming of R.
It is like this.
I am asked to run three models based on a sample of CPI:
Random walk
Recursive AR(4)
Rolling AR(4)
1.Based on the papers I find, I think the random walk may be similar to an AR(1) model (if with drift). But I am not sure whether this is right?
2.For the recursive model, I found a command named filter.
 m4=filter(Z,filter=c(c1,c2,c3,c4),method="recursive",side=1)
However, since it is not a simulating process, I cannot define the coefficients.
But this type of command needs specific coefs.
And I also try another code like m=filter(Z,rep(1,5),method="recursive",side=1). 
However, this command is applied to MA models.By doing rep(1,5), I think this means I define all the coefs to be 1.
Additionally, I tried the ?fiter.
But there are not that relevant examples.
3.For the rolling AR(4) model.
In fact, I have done a rollapply command for 12 years rolling windows for previous questions.
I think the methodology for the merge command should be used. Since rolling is a bit like a process of merging and moving on. 
But I do not know, in order to run a rolling AR(4) model, which command should I pick?


PS. If any additional packages like the TSA, need to be installed, please tell me. 


Thank you very much!
I am really looking forward to hear from you.


Best Regards
Candice




	[[alternative HTML version deleted]]

