[R] Mantel test least square line

Jari Oksanen jari.oksanen at oulu.fi
Tue Sep 8 19:19:40 CEST 2009


swertie <v_coudrain <at> voila.fr> writes:
> 
> Hello, I performed a Mantel test and plotted communitiy similarities. I
> would like to add a least square line. I thought about using abline taking
> as slope the r-statistic of the Mantel test and calculating the y-intercept
> analytically. Is this method correct? Is there any function for this
> calculation? Thank you

If you have Mantel statistic for two dist() objects (as produced by dist(), 
as.dist() or compatible functions), you can just use

abline(lm(ydist ~ xdist))

because dist object is a vector with some extra attributes.

Of course, this does not quite make sense, since distances do not have least 
squares fit in any reasonable sense. People do this all the time, though 
(ecologists, and aquatic ecologists in particular, I mean).

Cheers, Jari Okanen




More information about the R-help mailing list