[R] Error message when adding drift for Arima model

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Fri May 10 07:43:16 CEST 2019


Hello,

This is just a typo, in R logical values ("true) are not character 
strings. You must pass FALSE (the default, can be omited) or TRUE.

fitdata  <-  Arima(tsdata, c(2, 0, 0), include.drift = TRUE)


 From the help page ?logical

Details

TRUE and FALSE are reserved words denoting logical constants in the R 
language, whereas T and F are global variables whose initial values set 
to these. All four are logical(1) vectors.

Hope this helps,

Rui Barradas

Às 00:26 de 10/05/19, Bert Gunter escreveu:
> In future, always cc the list (unless it's personal,which this isn't). I
> have done so here. As I am largely ignorant on the subject matter, others
> will have to help, which is why you should cc the list.
> 
> Cheers,
> Bert Gunter
> 
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> 
> 
> On Thu, May 9, 2019 at 3:49 PM Michael Howell <mchowell2 using gmail.com> wrote:
> 
>> I apologize for that. The Arima() function that I'm trying to use comes
>> from the forecast package. I created a time series object using the above
>> 24 observations. The initial model I created doesn't seem to perform so
>> well so I thought a drift term might fit the data better. I used the
>> following code to create the time series object:
>>
>> tsdata<- ts(data, start = c(1,1), end = c(24,1), frequency = 1)
>>
>>
>> Where* data* is the dataframe that contains the initial 24 observations.
>> I then used the following code to try to create the model:
>>
>> fitdata  <-  Arima(tsdata,c(2,0,0),include.drift="true")
>>>
>>
>> After doing this I obtained the following error message:
>>
>> Error in (order[2] + seasonal$order[2]) > 1 & include.drift: operations
>>> are possible only for numeric, logical or complex types
>>> Traceback:
>>>
>>> 1. Arima(tsdata, c(2, 0, 0), include.drift = "true")
>>
>>
>>   I hope this is more clear.
>>
>> On Thu, May 9, 2019 at 4:39 PM Bert Gunter <bgunter.4567 using gmail.com> wrote:
>>
>>> Please start by reading and following the posting guide linked at the
>>> bottom of this email. In particular:
>>>
>>> 1) Post in **plain text** on this plain text list so we don't get the
>>> mangled html of your post.
>>>
>>> 2) Tell us what package Arima() is in.
>>>
>>> Cheers,
>>> Bert Gunter
>>>
>>>
>>>
>>>
>>> On Thu, May 9, 2019 at 2:27 PM Michael Howell <mchowell2 using gmail.com>
>>> wrote:
>>>
>>>> Hello everyone,
>>>> So this is my first post to this list, I'm trying to fit an Arima (2,0,0)
>>>> model and I think a drift term would help but I'm getting an error term
>>>> when I'm trying to include it. Here is my data:
>>>>
>>>> -6.732172338
>>>> -2.868884273
>>>> -5.371585089
>>>> -6.512740463
>>>> -4.171062657
>>>> -5.738499071
>>>> -3.343947176
>>>> -1.944879508
>>>> -5.464109272
>>>> -3.189183392
>>>> -3.684700232
>>>> -2.168303451
>>>> -2.329837082
>>>> -0.761979236
>>>> -2.189025304
>>>> 1.094238807
>>>> -4.812300745
>>>> 0.784198777
>>>> -1.567075922
>>>> 0.143963653
>>>> 1.131119051
>>>> 2.899746353
>>>> -0.498719993
>>>> 3.121623505 I created a time series object with 24 annual observations. I
>>>> didn't include dates because there isn't an observation for every year.
>>>>
>>>> tsdata<-ts(read.csv("...\\Pre2001LaunchDateTraining.csv"), start =
>>>> c(1,1),
>>>> end = c(24,1), frequency = 1) I then created a time series object using
>>>> the
>>>> Arima() function. fitdata <- Arima(tsdata,c(2,0,0),include.drift =
>>>> "true")
>>>> After executing I get this error: Error in (order[2] +
>>>> seasonal$order[2]) >
>>>> 1 & include.drift: operations are possible only for numeric, logical or
>>>> complex types Traceback: 1. Arima(tsdata, c(2, 0, 0), include.drift =
>>>> "true")
>>>> Any help would be greatly appreciated!
>>>>
>>>>          [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> 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]]
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>



More information about the R-help mailing list