Here are a few ways: Try this:
set.seed(123) TS <- ts(1:25 + rnorm(25)) tt <- time(TS) tt.pred <- end(tt)[1] + 1:10 both <- ts(c(TS, predict(lm(TS ~ tt), list(tt = tt.pred)))) ts.plot(both, TS, gpars = list(type = "o", col = 2:1, pch = 20)) and read ?ts, ?start, ?ts.plot and next time please provide some sample data using dput. See last line to every message and the posting guide. On Fri, Apr 2, 2010 at 8:14 AM, vibha patel <vibhapatel...@gmail.com> wrote: > Hello, > > I am using plot( ) function to plot time-series. > > it takes time-series object as an argument > but i want to plot predicted data with training set, to compare them. > > is there any function available? > > > Vibha > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > ______________________________________________ R-help@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.