allow permutations array via overloading#348
Conversation
This allows users to define a custom permutations array for the Moran_Local class to be used in crand. This is useful for custom applications.
Added new tests for the permutations_array argument in Moran_Local and crand. Fixed some test that were broken due to the new argument.
|
Yeah, this is what I had in mind when suggesting permutations overlaod in #344. Looks good to me! |
|
Thanks @ljwolf! We initially tried your @martinfleis suggestion but, not knowing the code in detail, entered in all sort of problems where permutations was used in other parts of the code. Thus, decided to have a new array passed. However, your solution is clearly more elegant. As for an example where this applies. I have to admit that we are not in the field of geo-statistics. We are using LMI in genomics where we generate "maps" of the Human genome and identify spatial correlations of all sort of data. This is implemented in our python library METALoci (https://github.com/3DGenomes/METALoci) that uses esda. Since the genome has linearity (that is, one gene up-stream is connected to the next gene down-stream), we needed a different shuffling that would take into consideration this. If I try to extrapolate to cases in your field, I could imaging that you may want to maintain cities connected if they are all in the same road so that they may need to be shuffled together. |
|
closing as I've pushed it onto @martirenom's #345 |
This applies @martirenom's wonderful #345 as an extension to the
permutationsargument, rather than as a separate argument. Hopefully this can illustrate what I have outlined in the review on #345.I am particularly excited about this feature, since it will let us represent hypotheses for block-wise shuffling, like shuffling only counties within states.