Stack Overflow Asked by Clemson on January 5, 2021
Is it possible to do a spatstat::scan.test
on a multitype ppp
? I know, of course, that you can do it on a 2-type marked point pattern:
P <- ppp(x=runif(100), y=runif(100), marks=factor(runif(100) >= 0.5))
scan.test(P, method="binomial", alternative="two.sided", nsim=100, r=0.1)
But, now, let’s say I adjust P
so that its marks multi-type instead:
marks(P) <- factor(round(runif(100, min=0, max=3)))
I now want to run a scan.test
on each combination of marks. Is there a way of doing this without just using a nested for
loop?
This is not supported, partly because it is problematic from a statistical viewpoint.
First, do you want to compare all pairs of possible types (i, j) or compare each type i against 'all other types' (not-i) ?
From a statistical viewpoint, this suffers from the "multiple testing problem"; since you are performing several hypothesis tests, the chance of getting a spuriously 'significant' outcome is much greater.
From a software viewpoint, the results of these multiple tests should be returned as a list of hypothesis tests (a list of objects of class htest
), which would make it incompatible with the output of other uses of scan.test
which return a single object of class htest
.
You can do these pairwise tests using a loop if you really want to.
There is a multinomial (i.e. generalisation of binomial to more than 2 types) version of the scan test. This would probably be the "right" way to treat these data. The complication there is to specify the alternative hypothesis (e.g. do you want to detect all instances where the pattern of cases is significantly different from the baseline? or only those instances where type 1 is significantly more abundant than types 2 and 3 relative to the baseline? etc etc) So this is not yet implemented either.
Correct answer by Adrian Baddeley on January 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP