Ken Ervin wrote:
I have a data set of 6 or so ordered pairs, and I've been able to graph
them and have decided to use a high-order polynomial regression. I've
used the following piece of code:
regression - function(x,y) {
x - c(insert_numbers_here)
y - c(insert_other_numbers_here)
?curve
regards,
Tom
Ken Ervin schrieb:
I have a data set of 6 or so ordered pairs, and I've been able to graph
them and have decided to use a high-order polynomial regression. I've
used the following piece of code:
regression - function(x,y) {
x - c(insert_numbers_here)
y -
On Wed, Oct 28, 2009 at 9:23 AM, Tom Gottfried tom.gottfr...@wzw.tum.de wrote:
?curve
regards,
Tom
and I was in the process of writing a curve example when I noticed Tom
sent this. Here it is:
set.seed(777)
x - runif(100, 0, 100)
y - 10*x + x^2 - .01*x^3 + rnorm(100, 0, 500)
fit - lm(y ~ x
Hi Ken,
Perhaps something like
plot(x,y)
lines(sort(x), fit$fitted.values[order(x)])
should do what I think you want. I think you have to be a bit careful
on the ordering of the fitted values so that they match up with the
order of the x variable, otherwise you get an odd looking line plot.
4 matches
Mail list logo