[R] Plot and lm
Par Leijonhufvud
par at hunter-gatherer.org
Thu Jun 4 19:47:57 CEST 2009
stephen sefick <ssefick at gmail.com> [2009.06.04] wrote:
> Could you provide a reproducible example even with fake data would be
> fine or dput() yours.
Sorry, I don't understand what you mean. Im my post was the first 8 lines of
my data, imported into R with
islands <- read.table("islands.csv", sep=",", h=T)
and the code was a cut-and-past from my .Rhistory. When I run it I get a
nice graph, but no line from abline (unless it is vertical or horizontal
and "superimposed" uppon one of the axes)... Which turns out ot be the
case:
Just running lm I get
> lm(mass~area)
Call:
lm(formula = mass ~ area)
Coefficients:
(Intercept) area
3.615e+02 5.967e-05
> lm(logmass~logarea)
Call:
lm(formula = logmass ~ logarea)
Coefficients:
(Intercept) logarea
-1.3480 0.4747
Forcing the graph with ylim=c(0,001,100000000) I see a line from the latter,
but (no surprise) none from the former. Now I just need to fix my
assumptions such that I produce a line that is an actual regession
line...
Thanks for making me think it through!
/Par
--
Par Leijonhufvud par at hunter-gatherer.org
The best comment I heard about Starship Troopers was "Based on the back cover
of a book by RAH".
-- Paul Tomblin
More information about the R-help
mailing list