[R] Plot and lm

Par Leijonhufvud par at hunter-gatherer.org
Thu Jun 4 16:11:29 CEST 2009


I want to make a log-log plot with a regression line, but I can't figure
out what I'm doing wrong. What I'm trying is:

plot(mass,area, log="xy", pch=as.numeric(food))
abline(lm(mass~area))

or

plot(mass,area, log="xy", pch=as.numeric(food))
islands$logmass <- log(mass)
islands$logarea <- log(area)
attach(islands)
abline(lm(logmass~logarea))


But that does not show a line. Where am I going wrong?

data: 
island, area,species,food,mass
Ibiza , 577 ,  Anser n. sp., herb,  2.0
Ibiza , 577 ,    Haliaeetus albicilla, carn, 4.8
Mauritius , 1874 ,  Raphus cucullatus, herb,  19 
Mauritius , 1874 ,  Circus alphonsi, carn, 0.63
Mallorca , 3667 , Myotragus balearicus, herb,  40 
Mallorca , 3667 , Aquila chrysaetos, carn, 4.2
Kreta , 8259 , Elephas creutzburgi, herb,  3200 
.......

/Par

-- 
Par Leijonhufvud                               par at hunter-gatherer.org
I don't believe in reincarnation.  I used to,
but that was in another life.




More information about the R-help mailing list