[R] How to plot a Quadratic Model?

2009-10-05 Thread Juliano van Melis
Good day for all, I'm a beginner aRgonaut, thus I'm having a problem to plot a quadratic model of regression in a plot. First I wrote: plot(Y~X) and then I tried: abline(lm(Y~X+I(X^2)) but abline only uses the first two of three regression coefficients, thus I tried: line(lm(Y~X+I(X^2)) but

Re: [R] How to plot a Quadratic Model?

2009-10-05 Thread Ista Zahn
I hardly use base graphics so I'm no help there. You can do this easily with ggplot2 though: library(ggplot2) X - rnorm(100) Y - rnorm(100) - X^2 qplot(x=X, y=Y, geom=c(point, smooth), method=lm, formula = y ~ poly(x, 2)) Note that X is not x and Y is not y in the sense that formula = Y ~

Re: [R] How to plot a Quadratic Model?

2009-10-05 Thread Kingsford Jones
see ?curve e.g. qftn - function(x) 1 + 2*x - .1*x^2 curve(qftn, 0, 10) hth, Kingsford On Mon, Oct 5, 2009 at 9:42 AM, Juliano van Melis jvme...@gmail.com wrote: Good day for all, I'm a beginner aRgonaut, thus I'm having a problem to plot a quadratic model of regression in a plot. First I