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]]
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. >
On Thu, 19 Nov 2009, Ricardo Gon?alves Silva wrote:> 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?This is a bug in Plot.Fore() which does not use the zoo functions correctly. It should be reported to the package maintainer. To avoid it, you can do Plot.Fore(as.vector(y1), ...) instead of Plot.Fore(y1, ...) Note to the maintainer (Jae Kim, Cc now): Plot.Fore() calls zooreg(x) where x is a "ts" object. This isn't the appropriate use of zooreg() which expects a numeric vector/matrix (or a factor). In the case above as.zoo(y1) would already be enough (and preserve all time information). Or you can manually call zooreg(coredata(y1), start = ..., end = ..., ....). See the zoo vignettes/examples for more details. Best, Z> 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. > >