An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091119/2b2e6a44/attachment-0001.pl>
Problem with zoo and BootPR packages
5 messages · Gabor Grothendieck, Achim Zeileis, Ricardo Gonçalves
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.
Ok, Thanks all. Rick. -------------------------------------------------- From: "Achim Zeileis" <Achim.Zeileis at wu-wien.ac.at> Sent: Thursday, November 19, 2009 3:06 PM To: "Ricardo Gon?alves Silva" <ricardogs at terra.com.br> Cc: "R-Help" <r-help at r-project.org>; <J.Kim at latrobe.edu.au> Subject: Re: [R] Problem with zoo and BootPR packages
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.
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.707 / Virus Database: 270.14.73/2513 - Release Date: 11/19/09 05:51:00
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.