[R] xreg in ARIMA function

From: E C <mmmraspberries_at_hotmail.com>
Date: Thu, 31 Jan 2008 15:42:40 -0500

Hi everyone,

I'm trying to include an external regressor in my ARIMA model but am having some problems with the data format in R. I've named my dependent variable of interest "count" and the external regressor "abc". The external regressor is a binary variable. Here are the contents of "abc" and the model I've attemped (along with its error message):

> abc

  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0
 [32] 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0
 [63] 0 0 1 1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1
 [94] 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0

[125] 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
[156] 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0
[187] 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0
[218] 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0
[249] 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0
[280] 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
[311] 0 1

> model <- arima(count, order=c(0,1,2), seasonal=list(order=c(1,0,0), period=52), include.mean=FALSE, method="ML", xreg=abc) > model
Series: count
ARIMA(0,1,2)(1,0,0)[52] Regression variables fitted:
Error in as.vector(x, mode) : cannot coerce to vector

I don't quite get the error message as I thought my external regressor variable is already stored in a vector. Any thoughts? Thanks in advance!


        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 31 Jan 2008 - 20:46:57 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 31 Jan 2008 - 21:30:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive