Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign uppermutest of dbrda fails with first=TRUE #198
Comments
suggested fix to github issue #198: permutest (and hence anova) failed when first=TRUE was requested
|
I have fixes in branch issue-#198. I'll do some testing, and if successful, merge the issue branch to master. |
|
I assume I have fixed the bugs. There was some sloppy implementation that we didn't catch in testing when releasing the in RDA-style methods we define the fitted values of Y as Ŷ = HY, where H is the "hat matrix" or projection matrix derived from constraints (independent variables) X. In db-RDA we use Gower-transformed symmetric dissimilarity matrix G, and following Anderson, we find its fitted values as Ĝ = HGH, where H is exactly the same hat matrix as above. In Here a simple example to show the problem in old code and a verification it works after the fix. Both of the following would fail in mod <- dbrda(dune ~ A1 + Moisture, dune.env, dist="bray")
modc <- dbrda(dune ~ Condition(Management) + A1 + Moisture, dune.env, dist="bray")They will work after the fix. To see this, it is best to use a bit more controlled procedure: p <- shuffleSet(nrow(dune), 99) # create permutation matrix
p[1,] <- sort(p[1,]) # make first permutation identical to data
tst <- permutest(mod, first = TRUE, permutations = p)
tst$F.0 - tst$F.perm[1] # compare observed statistic to first permutationThe observed statistic ( I'll merge this (with usual provision: nothing strange appears), and it will be included in the next release of vegan. |
Issue #198: permutest(<dbrda-result>, first = TRUE) fails
|
Solved and closed with PR #199 |
Cleo Tebby found the following code to fail:
It seems that the permutation results (
x$F.perm) are given in complex format with zero imaginary component (e.g.,10.565131+0i).