Dear Prof. Murdoch and Dr. Winsemius, Thank you very much for your suggestion. They were big help. One of my friends told me another approach by using "smooth.spline". Here is the code:
x <- c(1,2,3,4,5,6) y <- c(1,4,9,16,25,36) sp <- smooth.spline(x,y) x <- seq(1, 6, length=100) pred <- predict(sp, x) real <- x^2 err <- real - pred$y cbind(pred$x, pred$y, real, err) plot(pred) Thank a lot. Have a nice weekend :) Wang Zhipeng [[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.