[R] How to plot a Quadratic Model?
Kingsford Jones
kingsfordjones at gmail.com
Mon Oct 5 19:09:17 CEST 2009
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 <jvmelis at 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 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 a message error is showed ("insufficient observations").
>
> Therefore, I want to know: how could I plot a quadratic line in my plot
> graph?
>
> thanks!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list