[R] timeseries plot
Gabor Grothendieck
ggrothendieck at gmail.com
Fri Apr 2 15:42:03 CEST 2010
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 <vibhapatelddu at 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 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