[R] Autoregressive Model with Independent Variable

Jarrett Byrnes jebyrnes at ucdavis.edu
Thu Mar 2 17:44:52 CET 2006


On Mar 1, 2006, at 8:35 PM, Dirk Eddelbuettel wrote:

>
> 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)
> |
>
> Yes: arima(), see in particular the xreg argument.
>

Thanks so much!  arima() seems to mostly fit the bill.  I have data 
from multiple sites to use, as well.  e.g.

Time		y1 	x1	y2	x2
1		4	6	7	10
2		5	10	5	20
3		10	1	7	15
etc.

I would like to use all of the sites in creating a model - I realize 
that the structure of the model would now be along the lines of:

y(t)=b0+b1*y(t-1)+b2*y(t-2)...+a1*x(t)+a2*x(t-1)...+c

Where c is the site effect - I know this can get all wrapped up in the 
intercept, but, how does one pass this data to arima() to make it work? 
  I know that arima() takes a vector of y values - can it take a matrix 
of y values and a corresponding matrix of x values, or is there some 
other function that does this?

-Jarrett




More information about the R-help mailing list