Re: [R] Plotting a quadratic line on top of an xy scatterplot

2011-04-11 Thread jjap
Hi, Is it just me or it appears the "temperature" and "probability" should be reversed? Anyhow it should help you to assign your model to a variable (as Joshua did with his own suggestion) yourmodel <-lm(x[,2] ~ x[,1] + I(x[,1]^2)) # again, taking literally the way you formulated it...

Re: [R] Plotting a quadratic line on top of an xy scatterplot

2011-04-11 Thread Joshua Wiley
Hi Josh, This is by no means the fanciest solution ever, but as there are predict methods for many types of models in R, I thought I would show it this way. ## fit the model model <- lm(probability ~ poly(temperature, 2), data = x) ## create line values dat <- data.frame(temperature = seq(min(x$

[R] Plotting a quadratic line on top of an xy scatterplot

2011-04-11 Thread Josh B
Dear Listserv, Here is my latest in a series of simple-seeming questions that dog me. Consider the following data: x <- read.table(textConnection("temperature probability 0.11 9.4 0 2.3 0.38 8.7 0.43 9.2 0.6 15.6 0.47 8.7 0.09 12.8 0.11 9.4 0.01 7.7 0.83 8 0.65 9.3 0.05 7.4 0.34 10.1 0.02 4.8 0.

Re: [R] Plotting a Quadratic...

2008-05-22 Thread Jorge Ivan Velez
Hi Ryan, See the example in ?predict.lm . I think it would be useful in this case. HTH, Jorge On Wed, Dec 31, 1969 at 8:16 PM, Ryan Harrigan <[EMAIL PROTECTED]> wrote: > I have an equation describing the best-fit model for a set of points (just > 2 > axes) that is in the form: > > y=b+mx+px^2

[R] Plotting a Quadratic...

2008-05-22 Thread Ryan Harrigan
I have an equation describing the best-fit model for a set of points (just 2 axes) that is in the form: y=b+mx+px^2 Where b is the intercept, m is the slope describing a linear term, and p is a slope of the quadratic term. I would like to plot this equation on a curve (I know the equation is y=(