locfit can extrapolate: library(locfit) X <- seq(min(time(Nile)), max(time(Nile))+50)
plot(range(X), range(Nile), type = "n") lines(Nile) fit <- locfit(Nile ~ time(Nile)) lines(X, predict(fit, new = X), col = "red") On Fri, Oct 10, 2008 at 4:42 PM, Alex Karner <[EMAIL PROTECTED]> wrote: > Hi R community, > > I'm running R 2.7.2 on Windows XP SP2. > > I'm trying to (1) plot loess lines for each of my groupings using the same > color for each group; (2) plot loess predicted values. > > The first part is easy: > data1 <- > data.frame(Names=c(rep("Jon",9),rep("Karl",9)),Measurements=c(2,4,16,25,36,49,64,81,100,1,2,5,12,17,21,45,54,67),PlotAt=c(1:9,1:9)) > > data2 <- > data.frame(Names=c(rep("Jonah",9),rep("Beth",9)),Measurements=c(1:5,1,1,1,1,rep(20,9)),PlotAt=c(1:9,1:9)) > > xyplot(Measurements ~ PlotAt, data = data1, groups=Names, > > panel = function(...) { > panel.superpose(...,col="gray",lty=1,lwd=2); > }, > panel.groups = function(...) panel.loess(...) > ) > > My question is, how do I plot predicted values from loess to extend the > lines beyond the range of x? Let's say I want all lines to stop at x = 15. > Is there an easy way to do this? > > > Thanks for any help, > -AK > > [[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.