Hi:


On Thu, Oct 7, 2010 at 8:08 AM, Vangani, Ruchi <RVangani@bcbsm.com> wrote:

> I am trying to use auto.arima to fit a univariate time series and do
> forecast.
>

> This is an imaginary data on monthly outcomes of 2 years and I want to
> forecast the outcome for next 12 months of next year.
>
> data Data1;
> input RR;
> datalines;
> 12
> 14
> 17
> 15
> 13
> 15
> 15
> 14
> 15
> 14
> 16
> 15
> 15
> 18
> 16
> 16
> 15
> 14
> 15
> 16
> 16
> 14
> 13
> 12
> ;
> run;
>
> I successfully took this data into R and used the auto.arima codes but am
> getting the following error:
> fit <- auto.arima(Data1)
>
> ------------------------------------------------------------------------------------------------------------
> Error in model.frame.default(formula = x ~ 1, drop.unused.levels = TRUE) :
>  invalid type (list) for variable 'x'
>
> ------------------------------------------------------------------------------------------------------------
>

The error is telling you that your input data is a list; according to its
help page, auto.arima() expects a 'time series' as its first argument - it's
not immediately clear whether that means a ts (time series) object or
something else, but see below. Since we don't know how you read the data
into R, it's hard to tell whether it is actually a list, a data frame or
some other object that model.frame.default() interprets as a list. [And why
does your formula have the argument drop.unused.levels = TRUE?]

Look at the result of
str(Data1)
to see what type of object you have.

 I tried a numeric vector and a ts object (see ?ts to produce its help page)
as input to auto.arima() and both seemed to work OK. The example on the
auto.arima() help page was a Time-series object, so it apparently has some
flexibility in what it will accept as input...which means that you are the
one who has to know what type of object is being input into auto.arima().

Aside: I hope this is a test and not your 'real' data. You shouldn't be
doing ARIMA modeling on a series less than 50 in length, because the
forecast errors are likely to become large enough after a few lags to make
the forecast essentially worthless.

HTH,
Dennis

>
>
> Please help.
>
> Thanks,
> Ruchi
>
>
>
> The information contained in this communication is highl...{{dropped:18}}
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]

