[R] OT: compare several graphs
Kaspar Pflugshaupt
pflugshaupt at geobot.umnw.ethz.ch
Mon Oct 22 17:47:44 CEST 2001
On 22.10.2001 15:30 Uhr, Jan_Svatos at eurotel.cz wrote:
>
> Hi Sven,
>
> I am just doing something similar-
> my graphs are densities of nonnegative r.v's (with all probability mass at
> fixed bounded interval).
> Then I compute their "distance" by dist (mva package needed), i.e.
>
> my.dist<-dist(t(cbind(dens1$y, dens2$y)))
>
> (provided that dist1$x==dist2$x, of course)
> The problem of course is, how to decide about statistical and/or
> "practical" significance of a difference.
> I cannot remain myself of some correct statistical test of such hypothesis
I'm not sure if this is statistically sound (comments, please!), but what
about a resampling approach:
repeat some 1000 times:
shuffle one column randomly, then compute the distance
compare your distance to the empirical distribution of
"resampled distances"
In terms of R code:
Nreps <- 5000
dists <- numeric(Nreps)
for(i in 1:Nreps)
{
y2 <- sample(dens2$y)
dists[i] <- dist(t(cbind(dens1$y, y2)))
}
hist(dists)
quantile(dists, 0.05)
If the original distance is lower than the 5% quantile of the resampled
dists, your two graphs would be "significantly more similar" than "random
graphs". For a two-sided test, you could use
quantile(dists, c(0.025, 0.975)).
If this makes sense, there is still the problem of the correct distance
measurement. By default, dist() calculates euclidean distances. I'm not sure
it they are appropriate for this kind of data.
As I said, please comment. It's just an idea I had (along the lines of the
"Mantel test").
Cheers
Kaspar Pflugshaupt
--
Kaspar Pflugshaupt
Geobotanisches Institut
Zuerichbergstr. 38
CH-8044 Zuerich
Tel. ++41 1 632 43 19
Fax ++41 1 632 12 15
mailto:pflugshaupt at geobot.umnw.ethz.ch
privat:pflugshaupt at mails.ch
http://www.geobot.umnw.ethz.ch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list