Hello, Year ERI SSRI FTRI DFSRI IFSRI TRI SRI PSRI ERI2 1995 40.18 29.48 41.46 35.98 35.54 48.15 79.5 11.15 26.50120923 1996 42.96429 29.1 44.01 39.31 30.42 47.51 79.78 30.62 35.83816143 1997 44.85857 24.48 44.92 47.38 35.61 54.27 81.89 25.46 35.83816143 1998 47.49857 27.73 47.43 50.05 30.73 57.21 81.51 37.83 35.83816143 1999 48.74714 24.99 50.83 56.98 36.39 56.84 83.58 31.62 35.83816143 2000 50.93 36.05 47.93 55.58 39.49 54.47 83.82 39.17 35.83816143 2001 51.20857 37.88 45.8 50.58 42.64 57.41 85.82 38.33 35.83816143 2002 53.79 33.61 52.49 52.86 49.93 64.27 87.19 36.18 35.83816143 2003 61.35857 30.87 58.17 70.3 63.01 72.25 86.5 48.41 35.83816143 2004 60.20857 30.85 63.09 60.94 62.98 76.83 86.33 40.44 35.83816143 2005 63.45286 35.44 64.83 66.17 59.88 76.54 89.83 51.48 35.83816143 2006 65.10429 34.5 69.74 57.32 59.13 82.04 98.46 54.54 35.83816143
This is the dataset. for research i'm applying earth function on the dataset. the code is given below. the dataset:HCMecoref i want to plot prdHCMeco. but as the dataset is divided into training and testing sets, it only plots for testing data. i've refered ur reply. still having problem. and yes, i've refered ?ts.plot too. tr.ecoref<-sample(1:nrow(HCMecoref), 0.8*nrow(HCMecoref)) tst.ecoref<- (1:nrow(HCMecoref))[-tr.ecoref] HCMecoModel<-earth(ERI~SSRI+FTRI+DFSRI+IFSRI+TRI+SRI+PSRI+ERI2,data=HCMecoref[tr.ecoref,]) prdHCMeco<-predict(HCMecoModel, newdata=HCMecoref[tst.ecoref,]) #e2HCM<-HCMecoref$ERI[tst.ecoref] #RecoHCM<-(1-sum((e2HCM - prdHCMeco)^2)/sum((e2HCM-mean(e2HCM))^2)) #print(RecoHCM) ts_ecoref<-ts(data="prdHCMeco",...) plot(ts_ecoref) how to plot training dataset and testing dataset together in this case??? Thanks Vibha. On Fri, Apr 2, 2010 at 7:12 PM, Gabor Grothendieck <ggrothendi...@gmail.com>wrote: > 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. > > > [[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.