Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] PROTEST implementation #559

Closed
valentynbez opened this issue Dec 24, 2022 · 0 comments
Closed

[QUESTION] PROTEST implementation #559

valentynbez opened this issue Dec 24, 2022 · 0 comments

Comments

@valentynbez
Copy link

valentynbez commented Dec 24, 2022

In original Jackson 1995 the procedure for permutational testing is:

  • permute
  • gather $M^2$ values
  • select a fraction that is < original $M^2$

In the vegan implementation procedure goes as follows:

  • permute
  • gather $M^2$ values
  • select a fraction that is >= original $\sqrt{1 - M^2}$

vegan/R/protest.R

Lines 19 to 38 in 1c98b98

sol$t0 <- sqrt(1 - sol$ss)
N <- nrow(X)
## Permutations: We only need the goodness of fit statistic from
## Procrustes analysis, and therefore we only have the necessary
## function here. This avoids a lot of overhead of calling
## procrustes() for each permutation. The following gives the
## Procrustes r directly.
procr <- function(X, Y) sum(svd(crossprod(X, Y), nv=0, nu=0)$d)
permutations <- getPermuteMatrix(permutations, N)
if (ncol(permutations) != N)
stop(gettextf("'permutations' have %d columns, but data have %d observations",
ncol(permutations), N))
np <- nrow(permutations)
perm <- sapply(seq_len(np),
function(i, ...) procr(X, Y[permutations[i,],]))
Pval <- (sum(perm >= sol$t0 - EPS) + 1)/(np + 1)

What is the reason for choosing such an approach? (I am not the strongest in maths, it might be that I'm missing simple logic somewhere).

Also, as far as I understand, $m_{12}^2$ refers to the sum of squares or goodness-of-fit statistic from the publication of Peres-Neto & Jackson (2001). The same Jackson in 1995 refers to it as $M^2$.
Do you think the notation could be unified to avoid confusion?
I compared implementations in QIIME2 and vegan both, you can take a look at it here: https://forum.qiime2.org/t/procrustes-and-protest-analysis/20123/4

@vegandevs vegandevs locked and limited conversation to collaborators Dec 25, 2022
@jarioksa jarioksa converted this issue into discussion #560 Dec 25, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant