Skip to content
Prev 3379 / 7419 Next

summing F stats and permutation

Steve,

This is R, so it is not about whether this can be done, but how this can be done. Unfortunately, doing exactly this requires some fluency in R. Doing something similar is very simple.

The description of your problem sounds very much like the description of permutation test in redundancy analysis (RDA). The difference is that in RDA you sum up nominators and denominators before getting the ratio, but in your model you sum up the ratios. So in RDA test you have (num_1 + num_2 + ... + num_p)/(den_1 + den_2 + ... + den_p), and in your description you have num_1/den_1 + num_2/den_2 + ... + num_p/den_p. The former test in canned for instance in the vegan package, but the latter you must develop yourself (and the former method of summing variances instead of their ratios feels sounder). It would not be too many lines of code to fit your code, though. Please note that RDA works by fitting linear models for each species independently so that you can get all needed statistics from a fitted RDA in the vegan package (function rda). The following function extracts F-values by species from a fitted vegan:::rda() result object:

spF <-
function (object) 
{
   inherits(object, "rda") || stop("needs an rda() result object")
   df1 <- object$CCA$qrank
   df2 <- nrow(object$CA$Xbar) - df1 - 1
   num <- colSums(predict(object, type="working", model="CCA")^2)
   den <- colSums(predict(object, type="working", model="CA")^2)
   (num/df1)/(den/df2)
}

HTH, Jari Oksanen