
Based on my very limited experience with ts, it does not handle daily data very well, which leaves us three options: change data to weekly, which I think is probably not acceptablez <- to.weekly(Ad(GSPC))[,4]
z.ts<-ts(as.vector(z),start=as.numeric(c(format(index(z)[1],"%Y"),format(index(z)[1],"%m"))),
frequency=52)
y <-forecast(z.ts)
summary(y)
plot(y)
or assume 365 days (not good for leap years and results are very strange)require(quantmod)
require(forecast)
getSymbols("^GSPC", from='2006-01-06', to=Sys.Date())
z <- Ad(GSPC)
z.ts<-ts(as.vector(z),start=as.numeric(c(format(index(z)[1],"%Y"),format(index(z)[1],"%m"),format(index(z)[1],"%d"))),
frequency=365)
y <-forecast(z.ts)
summary(y)
plot(y) or convert to xts and then plot (ugly example but should get you started)y.xts <- as.xts(cbind(
  c(y$x,y$upper[,1]),
  c(y$x,y$upper[,2]),
  c(y$x,y$lower[,1]),
  c(y$x,y$lower[,2]),
  c(y$x,rep(y$x[NROW(y$x)],NROW(y$upper)))),
 c(index(z),index(last(z))+1:NROW(y$upper)))
plot.zoo(y.xts,screens=1,col=c(2:5,1))    Kenttimelyportfolio.blogspot.com
 > Date: Sat, 26 May 2012 14:51:54 -0400
> From: eric.thungstrom@gmail.com
> To: r-sig-finance@r-project.org
> Subject: [R-SIG-Finance] plotting with dates
> 
> How do I get this to plot with dates ? The x-axis is coming through with
> numbers.
> 
> require(quantmod)
> require(forecast)
> getSymbols("^GSPC", from='2006-01-06', to=Sys.Date())
> z <- Ad(GSPC)
> y <-forecast(z)
> summary(y)
> plot(y)
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Finance@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
 		 	   		  
	[[alternative HTML version deleted]]

