[R] Problem with zoo and BootPR packages

Gabor Grothendieck ggrothendieck at gmail.com
Thu Nov 19 19:03:53 CET 2009


Actually it may be that the documentation is at fault more than the
code.  The help page for Plot.Fore says that the first argument is a
time series data set and although that seems to suggest that it should
be a ts object the code seems to be written assuming a plain numeric
vector; therefore, you could do this:

library(zoo)
Plot.Fore(coredata(y1), forey1$forecast, start = 1966, end = 1984,
frequency = 1)

2009/11/19 Gabor Grothendieck <ggrothendieck at gmail.com>:
> Contact the BootPR maintainer regarding a bug in this line of Plot.Fore:
>
>   y1 <- zooreg(x, start, end, frequency)
>
> where x is a ts object but that may not be used in that context.
> as.zooreg is available for converting ts series (and certain other
> objects) to zooreg objects.
>
> 2009/11/19 Ricardo Gonçalves Silva <ricardogs at terra.com.br>:
>> Hi,
>>
>> I'm trying to plot the forecasts I generated using the Plot.Fore function of the BootPR package.
>> But I got an error from zoo:
>>
>> My data:
>>
>> Time Series:
>> Start = 1
>> End = 18
>> Frequency = 1
>>  [1]  38731  38628  39117  92809  71984  31226  58613  72360 107956  92066
>> [11]  95208  99098  95848 120383 110717 105680  98469 101916
>>
>> Script:
>>
>> y1<-ts(y1);
>> forey1<-BootBC(y1,p=2,h=3,nboot=5000,type="const+trend",correct="ssf")
>> Plot.Fore(y1,forey1$forecast,start=1966,end=1984,frequency=1)
>>
>> The Error:
>>
>> Error in zooreg(x, start, end, frequency) :
>>  "data" : attempt to define illegal zoo object
>>
>> Any Help?
>>
>> Thanks
>>
>> Rick
>>        [[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.
>>
>




More information about the R-help mailing list