[R] Autoregressive Model with Independent Variable

Dirk Eddelbuettel edd at debian.org
Thu Mar 2 05:35:56 CET 2006


On 1 March 2006 at 20:06, Jarrett Byrnes wrote:
| Hey, all, I may just be missing something, but I'm trying to construct 
| a temporal autoregression with an independant variable other than just 
| what is happened at a previous point in time.  So, the model structure 
| would be something like
| 
| y(t)=b0+b1*y(t-1)+b2*y(t-2)...+a*x(t)
| 
| I'm even considering a model of
| 
| y(t)=b0+b1*y(t-1)+b2*y(t-2)...+a1*x(t)+a2*x(t-1)...
| 
| So, my data looks like
| 
| Time		y 	x
| 1		4	6
| 2		5	10
| 3		10	1
| etc.
| 
| When looking at ar() and similar methods, however, it seemed that the 
| input was a single vector - say, in this case, the value y.  Is there a 
| method that allows me to specify an explicit model that would then 
| incorporate x?

Yes: arima(), see in particular the xreg argument.

Dirk


-- 
Hell, there are no rules here - we're trying to accomplish something. 
                                                  -- Thomas A. Edison




More information about the R-help mailing list