[R] Plotting a smooth curve from predict
Wilson, Andrew
eiaaw at exchange.lancs.ac.uk
Tue Jul 31 12:21:57 CEST 2007
Probably a very simple query:
When I try to plot a curve from a fitted polynomial, it comes out rather
jagged, not smooth like fitted curves in other stats software. Is there
a way of getting a smooth curve in R?
What I'm doing at the moment (for the sake of example) is:
> x <- c(1,2,3,4,5,6,7,8,9,10)
> y <- c(10,9,8,7,6,6.5,7,8,9,10)
> b <- data.frame(cbind(x,y))
> w <- gls(y ~ I(x)+I(x^2),correlation=corARMA(p=1),method="ML",data=b)
> plot(predict(w),type="l")
Many thanks,
Andrew Wilson
More information about the R-help
mailing list