[R] Trouble with line of best fit

DimmestLemming NICOADAMS000 at GMAIL.COM
Mon Jul 25 20:26:55 CEST 2011

I don't usually do much with graphs in R, and this is my first time adding a
line of best fit. Hopefully this is an easy problem to solve.

I'm looking at a variable called soloKills along the range 5:28. Here are
all my commands, in script form:

title="Solo kill/death data"
xlabel="Number of deaths/1 game"
ylabel="Mean number of kills/1 game"     #No problems with the scatterplot

plot(x=range, y=graph, main=title, xlab=xlabel, ylab=ylabel, ylim=c(0,20))


I checked several websites, the abline(lm(/x-variable/~/y-variable/)) format
*should* work. But here is what happens:


The line is obviously far too steep. I can guarantee there are no outliers
in soloKills to throw it off:

> soloKills
 [1]  9.040472 10.184595 11.201935 12.130823 13.583477 14.098845 14.489703
 [8] 15.329752 15.562500 15.884757 16.239704 16.513289 16.383912 16.547543
[15] 16.823374 17.051370 17.027644 17.300562 17.641723 17.702673 18.436170
[22] 18.783562 19.274419 21.373832

Can anyone help me fix the regression line? Thanks!

View this message in context: http://r.789695.n4.nabble.com/Trouble-with-line-of-best-fit-tp3693567p3693567.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list